我尝试使用以下函数更改laravel datatable
的日期格式,但它不起作用。
我收到以下错误消息:
DataTables警告:table id = users-table - Ajax错误。更多 有关此错误的信息,请参阅http://datatables.net/tn/7
代码:
$users=Checks::select(['details','postingdate','description','amount','type','slip','vendor_id','category_id']);
return Datatables::of($users)->editColumn('postingdate', function ($user) {
return $user->postingdate->format('d-m-Y');
})->make(true);
我如何解决这个问题?
答案 0 :(得分:0)
$users=Checks::select(['details',
'postingdate','description','amount','type','slip','vendor_id','category_id']);
return Datatables::of($users)->editColumn('postingdate', function ($user)
{
//change over here
return date('Y/d/m', strtotime($user->postingdate) );
})->make(true);