im working with datatables (yajra) and laravel.
i have working the datatables but i have error when i try to search. "sqlstate 42s22 column not found 1054 unknown column 'customer.' in where clause'"
my controller:
$query = DB::table('customer')->orderBy('id');
return DataTables::queryBuilder($query)->toJson();
My view:
if (dtUserTable.length) {
dtUserTable.DataTable({
pageLength: 10,
stateSave: true,
processing: true,
serverSide: true,
ajax:{url:"customer-list"},
columns: [
// columns according to JSON
{ data: 'id' },
{ data: 'fullname' },
{ data: 'num_doc'},
{ data: 'mobile' },
{ data: 'email' },
{ data: 'class' },
{ data: '' }
],
columnDefs: [
{
// For Responsive
className: 'control',
orderable: false,
responsivePriority: 2,
targets: 0
},
extra: if i use this:
$customers = DB::table('customer')->get();
return json_decode($customers,true);
it work, but not work the server side!
Any can help me to make it work with server side and search? i try some configs and only can make work serverside OR search