1 | <?php |
||
9 | abstract class AbstractDataTable extends DataTable |
||
10 | { |
||
11 | /** |
||
12 | * The model class. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $model; |
||
17 | |||
18 | /** |
||
19 | * The transformer class. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $transformer; |
||
24 | |||
25 | /** |
||
26 | * Get columns. |
||
27 | * |
||
28 | * @return array |
||
29 | */ |
||
30 | abstract protected function getColumns(); |
||
31 | |||
32 | /** |
||
33 | * Get the query object to be processed by dataTables. |
||
34 | * |
||
35 | * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Support\Collection |
||
|
|||
36 | */ |
||
37 | public function query() |
||
43 | |||
44 | /** |
||
45 | * Display ajax response. |
||
46 | * |
||
47 | * @return \Illuminate\Http\JsonResponse |
||
48 | */ |
||
49 | public function ajax() |
||
57 | |||
58 | /** |
||
59 | * Optional method if you want to use html builder. |
||
60 | * |
||
61 | * @return \Yajra\DataTables\Html\Builder |
||
62 | */ |
||
63 | public function html() |
||
70 | |||
71 | /** |
||
72 | * Process DataTables needed render output. |
||
73 | * |
||
74 | * @param string $view |
||
75 | * @param array $data |
||
76 | * @param array $mergeData |
||
77 | * |
||
78 | * @return \Illuminate\Http\JsonResponse|\Illuminate\View\View |
||
79 | */ |
||
80 | public function render($view, $data = [], $mergeData = []) |
||
96 | |||
97 | /** |
||
98 | * Get default builder parameters. |
||
99 | * |
||
100 | * @return array |
||
101 | */ |
||
102 | protected function getBuilderParameters() |
||
103 | { |
||
104 | return [ |
||
105 | 'keys' => true, |
||
106 | 'autoWidth' => false, |
||
107 | 'dom' => "<'row'<'col-sm-6'B><'col-sm-6'f>> <'row'r><'row'<'col-sm-12't>> <'row'<'col-sm-5'i><'col-sm-7'p>>", |
||
108 | 'buttons' => [ |
||
109 | ['extend' => 'create', 'text' => '<i class="fa fa-plus"></i> '.trans('cortex/foundation::common.new')], 'print', 'reset', 'reload', 'export', |
||
110 | ['extend' => 'colvis', 'text' => '<i class="fa fa-columns"></i> '.trans('cortex/foundation::common.columns').' <span class="caret"/>'], |
||
111 | ['extend' => 'pageLength', 'text' => '<i class="fa fa-list-ol"></i> '.trans('cortex/foundation::common.limit').' <span class="caret"/>'], |
||
112 | ], |
||
113 | ]; |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Get filename for export. |
||
118 | * |
||
119 | * @return string |
||
120 | */ |
||
121 | protected function filename() |
||
127 | } |
||
128 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.