-
-
Notifications
You must be signed in to change notification settings - Fork 855
Closed
Description
`I am using serverside render. And my code is below.
There's only 2500 products on list.
And it takes 30 seconds to render. If I remove "Datatables::of($products)->make(true);" line, it returns on 20ms.
What's wrong with it?
What should I do?
$parameters = $this->request->query();
$firm_id = $this->request->user()->firm_id;
$products = Product::where('firm_id', $firm_id)
->with(['category', 'inventory' => function($q){
$q->where('cost', '>', 0);
}])
->orderBy('id', 'desc');
if(isset($parameters['category_id'])){
$products = $products->where('product_category_id', $parameters['category_id']);
}
$products = $products->get();
$products = ProductResource::collection($products);
return Datatables::of($products)->make(true);`