I'm using Laravel Datatables package to show Ajaxified tables.
I'm getting an error when the collection i want to show in my table is empty, the error is:
ErrorException in CollectionEngine.php line 46: array_keys() expects parameter 1 to be array, null given
My controller contains two simple functions
// get the view
public function getItems() {
return view('someview');
}
// get data for datatables
public function getItemsdata() {
$data = DataModel::all();
return Datatables::of($data)->make(true);
}
When $data is not empty, everything works just fine but if it is empty, I get the error! how can i fix this? any ideas?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TXXSqV
via IFTTT
Aucun commentaire:
Enregistrer un commentaire