addButtons(datatables()->eloquent($query)); } /** * Add buttons DataTable class. * * @param mixed $query Results from query() method. * @return \Yajra\DataTables\DataTableAbstract */ public function addButtons($datatables) { return $datatables->addColumn('action', $this->getHtmlButtons()); } public function getHtmlButtons() { $buttons = ''; // $buttons .= ''; // $buttons .= ''; $buttons .= ''; $buttons .= ''; return $buttons; } public function makeColumnButtons() { return Column::computed('action') ->exportable(false) ->printable(false) ->searchable(false) ->width(120) ->addClass('text-center'); } /** * Get query source of dataTable. * * @param \App\Family $model * @return \Illuminate\Database\Eloquent\Builder */ public function buildQuery($model) { return $model->newQuery(); } /** * Optional method if you want to use html builder. * * @return \Yajra\DataTables\Html\Builder */ public function html() { return $this->buildHtml(strtolower($this->model_name) . '-table'); } /** * Optional method if you want to use html builder. * * @return \Yajra\DataTables\Html\Builder */ public function buildHtml($id) { return $this->builder() ->setTableId($id) ->parameters($this->getParameters()) ->columns($this->getColumns()) ->minifiedAjax() ->dom($this->getDom()) ->orderBy(0,'asc') ->buttons( Button::make('export'), Button::make('print') ); } public function getParameters() { return [ 'pageLength' => 10 ]; } public function getDom() { $dom = ''; // $dom .= $this->getDatatablesHeaderDefault(); $dom .= "tr"; $dom .= $this->getDatatablesFooterDefault(); return $dom; } public function getDatatablesHeader() { return view('components.datatables.header'); } public function getDatatablesHeaderDefault() { // return "