I am trying to re-write an table from my view to a DataTables for easy filtering etc. For this I am using yajra/laravel-datatables. Within my original view I would conditionally return the following line:
@include("partials.delete", ["id" => $advice->id, "url" => URL::action("AdviceController@destroy")])
I would now need to return this line from my Controller which uses DataTables. But unfortuanlly, I can't seem to get it right. I also haven't found other people with this issue. My code in the controller is defined like:
return Datatables::of($advice)
->addColumn('delete', function($row){
if($row->original_user_id == \Auth::id()){
return '';
}
})
->make(true);
But this literally returns the line of code in my view. Could someone help me to return the @include
line?
via Anna Jeanine