unit property in my products json
This commit is contained in:
parent
899884d8a7
commit
b1b0612fe3
|
|
@ -463,6 +463,12 @@ class ProductsAPIController extends Controller
|
|||
'images:attachment_id,attachment_type,disk_name,file_name')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->paginate($perPage);
|
||||
|
||||
if($products) {
|
||||
foreach ($products as $product) {
|
||||
$product->unit = new MeasureResource($product->measure);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->helpers->apiArrayResponseBuilder(500, 'server error', ['message' => 'Something went wrong']);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue