source = $source;
}
/**
* Create an HTTP response that represents the object.
*
* @param Request $request
*
* @return Response
*/
public function toResponse($request)
{
return $this->make()->toJson();
}
/**
* Make table response for the resource.
*
* @param mixed $source
*
* @return JsonResponse
*/
public function make()
{
return $this->newTable();
}
/**
* Create a new datatable instance;
*
* @return DataTables
* @throws Exception
*/
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);
})
->editColumn('updated', function ($entity) {
return view('admin::partials.table.date')->with('date', $entity->updated_at);
})
->rawColumns(array_merge($this->defaultRawColumns, $this->rawColumns))
->removeColumn('translations');
}
}