';
if ($this->viewFaqPermission == 'all') {
$action .= '';
}
if ($this->editFaqPermission == 'all') {
$action .= '
';
return $action;
})
->rawColumns(['action', 'description']);
}
/**
* Get query source of dataTable.
*
* @param Faq $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(Faq $model)
{
$request = request();
$model = $model->newQuery()->with('category');
if ($request->category && $request->category != 'all') {
$model->where('faq_category_id', $request->category);
}
return $model;
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->setBuilder('superadmin-faq-table', 3)
->parameters([
'initComplete' => 'function () {
window.LaravelDataTables["superadmin-faq-table"].buttons().container()
.appendTo("#table-actions")
}',
'fnDrawCallback' => 'function( oSettings ) {
$("body").tooltip({
selector: \'[data-toggle="tooltip"]\'
})
}',
]);
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns()
{
return [
'#' => ['data' => 'DT_RowIndex', 'orderable' => false, 'searchable' => false, 'visible' => false],
__('app.id') => ['data' => 'id', 'name' => 'id', 'title' => __('app.id')],
__('app.title') => ['data' => 'title', 'name' => 'title', 'exportable' => false, 'title' => __('app.title')],
__('app.category') => ['data' => 'category', 'name' => 'category', 'title' => __('app.category')],
__('app.description') => ['data' => 'description', 'name' => 'description', 'title' => __('app.description'), 'orderable' => false,],
Column::computed('action', __('app.action'))
->exportable(false)
->printable(false)
->orderable(false)
->searchable(false)
->addClass('text-right pr-20')
];
}
}