datatables ->eloquent($this->query()) ->addColumn('action', 'path.to.action.view') ->make(true); } /** * Get the query object to be processed by dataTables. * * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Support\Collection */ public function query() { $query = ModelName::query(); return $this->applyScopes($query); } /** * Optional method if you want to use html builder. * * @return \Yajra\Datatables\Html\Builder */ public function html() { return $this->builder() ->columns($this->getColumns()) ->ajax('') ->addAction(['width' => '80px']) ->parameters($this->getBuilderParameters()); } /** * Get columns. * * @return array */ protected function getColumns() { return [ 'id', // add your columns 'created_at', 'updated_at', ]; } /** * Get filename for export. * * @return string */ protected function filename() { return 'DummyFilename_' . time(); } }