Working on products api

This commit is contained in:
David Bomba 2016-01-30 22:16:25 +11:00
parent 1e8a4c2b70
commit 1f36e175dd

View File

@ -29,11 +29,12 @@ class ProductApiController extends BaseAPIController
public function index() public function index()
{ {
$products = Product::scope()->withTrashed(); //$products = Product::scope()->withTrashed()->orderBy('created_at', 'desc')->paginate();
$products = $products->orderBy('created_at', 'desc')->paginate(); //$products = $products
$products = Product::scope()->withTrashed()->paginate();
$transformer = new ProductTransformer(\Auth::user()->account, $this->serializer); $transformer = new ProductTransformer(\Auth::user()->account, $this->serializer);
$data = $this->includeCollection($products, $transformer, 'products', $products->paginate()); $data = $this->includeCollection($products, $transformer, 'products');
return $this->response($data); return $this->response($data);