Calling DataTables::of for collection is leading to error
"A non well formed numeric value encountered"
{"draw":1,"recordsTotal":21,"recordsFiltered":0,"data":[],"error":"Exception Message:\n\nA non well formed numeric value encountered"}
public function getReport(Request $request)
{
$start = Carbon::parse($request->start)->format('Y-m-d ');
$end = Carbon::parse($request->end)->format('Y-m-d');
$cdrs = Cdr::whereBetween(DB::raw('date(start)'), [$start, $end])->get(['src', 'dst', 'start', 'answer', 'end', 'duration', 'disposition', 'recordingfile']);
//dd($cdrs);
return DataTables::of($cdrs)->toJson();
}
Sorry to bother guys. I was doing a silly mistake! Calling get() to select columns.
Error is coming when I put serverSide: true
You should not use start on your variable name because DT uses this for pagination. Try changing the variable name.
$request->start --> $request->start_date
Most helpful comment
You should not use
starton your variable name because DT uses this for pagination. Try changing the variable name.