using laravel 5.4 I get an error when I try to run the index view. Checking in firebug, I get this:
ErrorException in Datatables.php line 57: Invalid argument supplied for foreach()
My routes:
Route::get('promotions.data', 'PromotionController@getPromotions')->name('promotions.data');
Route::resource('promotions', 'PromotionController');
My ajax call:
$('#promotionsTbl').DataTable({
processing: true,
serverSide: true,
ajax: '{!! url('promotions.data') !!}',
columns: [
{ data: 'id', name: 'id' },
{ data: 'name', name: 'name' },
{ data: 'from_date', name: 'from_date' },
{ data: 'to_date', name: 'to_date' }
]
});
My Controller:
public function getPromotions()
{
return Datatables::of(Promotion::query())->make(true);
}
Can anyone please help?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire