eloquent($query) ->addColumn('action', function ($data) { return view('adjustment::partials.actions', compact('data')); }); } public function query(Adjustment $model) { return $model->newQuery()->withCount('adjustedProducts'); } public function html() { return $this->builder() ->setTableId('adjustments-table') ->columns($this->getColumns()) ->minifiedAjax() ->dom("<'row'<'col-md-3'l><'col-md-5 mb-2'B><'col-md-4'f>> . 'tr' . <'row'<'col-md-5'i><'col-md-7 mt-2'p>>") ->orderBy(0) ->buttons( Button::make('excel') ->text(' Excel'), Button::make('print') ->text(' Print'), Button::make('reset') ->text(' Reset'), Button::make('reload') ->text(' Reload') ); } protected function getColumns() { return [ Column::make('date') ->className('text-center align-middle'), Column::make('reference') ->className('text-center align-middle'), Column::make('adjusted_products_count') ->title('Products') ->className('text-center align-middle'), Column::computed('action') ->exportable(false) ->printable(false) ->className('text-center align-middle') ]; } protected function filename() { return 'Adjustments_' . date('YmdHis'); } }