mercredi 15 août 2018

Call to a member function take() on array laravel

I'm using Laravel 5.2 and what I want to do is to populate a jQuery Datatable from information from my database. Here is my code to do that:

Route::get('/a/VentasPorSucursal', function(){
   $values = [1, 8000, 2, "NULL", "2018-06-10", "2018-08-10", "NULL", "NULL"];
   $data = DB::select('SP_RPT_VENTAS2 ?, ?, ?, ?, ?, ?, ?, ?', $values)->take(10);

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

When I run my app I get the following error message:

Call to a member function take() on array

If I remove this part of my code everything works fine:

->take(10)

I also tried using ->paginate(10) but I get the same error message.

What could be the problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire