How to add array in datatables? (laravel)
How to add array in datatables? (laravel)

Controller
array_push($results, [
'name' => $name,
'last_modified' => $lastmodified,
'size' => $this->humanReadable($size),
]);
return Datatables::of($results)->make(true);
JS
$(function() {
var table = $('#backuptable').DataTable({
processing: false,
serverSide: true,
ajax: '{!! route('get.backup') !!}',
columns: [
{ data: 'name', name: 'name' },
{ data: 'last_modified', name: 'last_modified' },
{ data: 'size', name: 'size' },
]
});
});
This discussion has been closed.
Answers
Do you want to give us some clues? Are you seeing errors? Is the table not loading?
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin