Working on products api
This commit is contained in:
parent
1da8f6bc26
commit
1e8a4c2b70
1 changed files with 8 additions and 1 deletions
|
|
@ -29,7 +29,14 @@ class ProductApiController extends BaseAPIController
|
|||
|
||||
public function index()
|
||||
{
|
||||
//stub
|
||||
$products = Product::scope()->withTrashed();
|
||||
$products = $products->orderBy('created_at', 'desc')->paginate();
|
||||
|
||||
$transformer = new ProductTransformer(\Auth::user()->account, $this->serializer);
|
||||
$data = $this->includeCollection($products, $transformer, 'products', $products->paginate());
|
||||
|
||||
return $this->response($data);
|
||||
|
||||
}
|
||||
|
||||
public function getDatatable()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue