{消息:"Method addColumns does not exist.",异常:"BadMethodCallException",…}
{message: "Method addColumns does not exist.", exception: "BadMethodCallException",…}
我想在 laravel 中使用 Yajra DataTable。但我得到这个错误:
{消息:"Method addColumns does not exist.",异常:"BadMethodCallException",…}
这是我的代码:
public function show(Request $request)
{
if($request->ajax()){
$searchs = $request->get('search');
$search = $searchs['value'];
DB::statement(\DB::raw('set @nomor = 0'));
$index = DB::table('tb_test')->
select([DB::raw('@nomor := @nomor + 1 as no'),
'id',
'name'
]);
return DataTables::of($index)
->addColumns('action', function($index){
$tag = "<center><a class='btn btn-info btn-xs' onclick=editNewModal('".$index->id."')><i class='fa fa-pencil'></i> Ubah</a>";
$tag .= "<a class='btn btn-danger btn-xs' onclick=delNewModal('".$index->id."')><i class='fa fa-trash'></i> Hapus</a></center>";
return $tag;
})
->make(true);
}
有人可以帮我解决这个问题吗?
最后,我注意到我忘了做
"composer dumpautoload".
我想在 laravel 中使用 Yajra DataTable。但我得到这个错误: {消息:"Method addColumns does not exist.",异常:"BadMethodCallException",…}
这是我的代码:
public function show(Request $request)
{
if($request->ajax()){
$searchs = $request->get('search');
$search = $searchs['value'];
DB::statement(\DB::raw('set @nomor = 0'));
$index = DB::table('tb_test')->
select([DB::raw('@nomor := @nomor + 1 as no'),
'id',
'name'
]);
return DataTables::of($index)
->addColumns('action', function($index){
$tag = "<center><a class='btn btn-info btn-xs' onclick=editNewModal('".$index->id."')><i class='fa fa-pencil'></i> Ubah</a>";
$tag .= "<a class='btn btn-danger btn-xs' onclick=delNewModal('".$index->id."')><i class='fa fa-trash'></i> Hapus</a></center>";
return $tag;
})
->make(true);
}
有人可以帮我解决这个问题吗?
最后,我注意到我忘了做
"composer dumpautoload".