Dmitry Malys
Dmitry Malys

Reputation: 1323

DataTables YajraBox Laravel extension with Eloquent Query String Filtering

im newbie Laravel, im trying to create a data table with YajraBox extension.

Im stuck on ajax controller:

public function indexData(LotFilters $filters)
    {
       $lots  = Lot::filter($filters)->get();

        return Datatables::of($lots)->make(true);
    } 

This is my route:

Route::get('data', 'LotController@indexData');

When i go: http://127.0.0.1:8000/data it gives me an error:

Allowed memory size of 134217728 bytes exhausted (tried to allocate 140673944 bytes)

It think i need to set up a pagination, but i didn't find a example how to do it, maybe you guys can help me?

Upvotes: 2

Views: 804

Answers (2)

Dmitry Malys
Dmitry Malys

Reputation: 1323

Actually i find a solution just now. i just need to remove ->get(); from the end.

Upvotes: 2

Junaid Ahmad
Junaid Ahmad

Reputation: 599

you are making get request which may cause this error. Try to make a post request.

Upvotes: 2

Related Questions