ok
Direktori : /home2/selectio/www/limpiar.in.net/app/Http/Resources/ |
Current File : /home2/selectio/www/limpiar.in.net/app/Http/Resources/PosProductCollection.php |
<?php namespace App\Http\Resources; use Illuminate\Http\Resources\Json\ResourceCollection; class PosProductCollection extends ResourceCollection { public function toArray($request) { return [ 'data' => $this->collection->map(function($data) { return [ 'id' => $data->id, 'stock_id' => $data->stock_id, 'name' => $data->name, 'thumbnail_image' => ($data->stock_image == null) ? uploaded_asset($data->thumbnail_img) : uploaded_asset($data->stock_image), 'price' => home_discounted_base_price_by_stock_id($data->stock_id), 'base_price' => home_base_price_by_stock_id($data->stock_id), 'qty' => $data->stock_qty, 'variant' => $data->variant, 'digital' => $data->digital, ]; }) ]; } public function with($request) { return [ 'success' => true, 'status' => 200 ]; } }