For reasons of quantity of values in the tables I had to switch to work with the serverside to speed up the loading of the tables but now I find myself in difficulty because I can't get the codes I generate to work as before.
I created the tables with the command php artisan datatables:make Tickets, and php artisan datatables:editor Tickets, everything works perfectly now if I create a new table and add
(TicketsDataTable)
public function query(Ticket $model): QueryBuilder { return $model->newQuery() ->whereYear('created_at', '2023') ->whereIn('status', [closed','suspended']); }
it works properly. I wanted to do in the controller to create specific tables and I tried to do
(TicketsController)
public function index(TicketsDataTable $dataTable) { $data = DB::table('tickets') ->whereYear('created_at', '2023') ->whereMonth('created_at','01') ->whereIn('status', ['closed]);
return $dataTable->render('tickets.index',compact('data'));
}
but nothing is filtered the page loads the table with everything and not just with the values I'm looking for, where am I going wrong?