source = $source;
}
/**
* Make table response for the resource.
*
* @param mixed $source
* @return \Illuminate\Http\JsonResponse
*/
public function make()
{
return $this->newTable();
}
/**
* Create a new datatable instance;
*
* @param mixed $source
* @return \Yajra\DataTables\DataTables
*/
public function newTable()
{
return datatables($this->source)
->addColumn('checkbox', function ($entity) {
return view('admin::partials.table.checkbox', compact('entity'));
})
->editColumn('status', function ($entity) {
return $entity->is_active
? ''
: '';
})
->editColumn('created', function ($entity) {
return view('admin::partials.table.date')->with('date', $entity->created_at);
})
->rawColumns(array_merge($this->defaultRawColumns, $this->rawColumns))
->removeColumn('translations');
}
/**
* Create an HTTP response that represents the object.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function toResponse($request)
{
return $this->make()->toJson();
}
}