I wanna use Yajra DataTable in laravel. but i get this error : {message: "Method addColumns does not exist.", exception: "BadMethodCallException",…}
and this is my code :
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);
}
can someone help me to fix this?
Finally, I've noticed that I forgot to do
"composer dumpautoload".