overload when get data in data table in Laravel

  datatable, datatables, json, laravel, php

when I open the page to show the product I get this error

DataTables warning: table id=geniustable – Ajax error. For more information about this error, please see http://datatables.net/tn/7

and when I search in my code I found this line if I change to get just 50 rows it will be run without problem but if I get the total product ( 800 ) I have this error

$datas = Product::where('product_type','=','normal')->orderBy('id','desc')->get();

I try also to use max memory,

$oldLimit = ini_get( 'memory_limit' );
ini_set( 'memory_limit', '-1' );
ini_set( 'memory_limit', $oldLimit );

it works a few days and the error return again, what can I do to show the total products

Source: Laravel

Leave a Reply