[Bug] On relation in HTML Builder
This commit is contained in:
@@ -18,8 +18,7 @@ class ParentDataTable extends DataTable
|
||||
*/
|
||||
public function dataTable($query)
|
||||
{
|
||||
$datatables = datatables()->eloquent($query);
|
||||
return self::addButtons($datatables);
|
||||
return $this->addButtons(datatables()->eloquent($query));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,18 +29,28 @@ class ParentDataTable extends DataTable
|
||||
*/
|
||||
public function addButtons($datatables)
|
||||
{
|
||||
$buttons = self::getHtmlButtons();
|
||||
return $datatables->addColumn('action', $buttons);
|
||||
return $datatables->addColumn('action', $this->getHtmlButtons());
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
||||
$buttons = '';
|
||||
// $buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-edit"></i></button>';
|
||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-danger btn-del"><i class="fa fa-fw fa-trash"></i></button>';
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
public function makeColumnButtons()
|
||||
{
|
||||
return Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->searchable(false)
|
||||
->width(80)
|
||||
->addClass('text-center');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query source of dataTable.
|
||||
*
|
||||
@@ -61,7 +70,7 @@ class ParentDataTable extends DataTable
|
||||
*/
|
||||
public function html()
|
||||
{
|
||||
return self::buildHtml(strtolower($this->model_name) . '-table');
|
||||
return $this->buildHtml(strtolower($this->model_name) . '-table');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user