1 | <?php |
||
10 | class LogsDataTable extends AbstractDataTable |
||
11 | { |
||
12 | /** |
||
13 | * {@inheritdoc} |
||
14 | */ |
||
15 | protected $model = Log::class; |
||
16 | |||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | protected $transformer = LogTransformer::class; |
||
21 | |||
22 | /** |
||
23 | * Get the query object to be processed by dataTables. |
||
24 | * |
||
25 | * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Support\Collection |
||
|
|||
26 | */ |
||
27 | public function query() |
||
33 | |||
34 | /** |
||
35 | * Get default builder parameters. |
||
36 | * |
||
37 | * @return array |
||
38 | */ |
||
39 | protected function getBuilderParameters() |
||
40 | { |
||
41 | return [ |
||
42 | 'keys' => true, |
||
43 | 'autoWidth' => false, |
||
44 | 'order' => [[0 => 'asc']], |
||
45 | '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>>", |
||
46 | 'drawCallback' => "function (settings) { |
||
47 | var api = this.api(); |
||
48 | |||
49 | $('#{$this->id} tbody td.dt-details-control').on('click', function () { |
||
50 | var tr = $(this).closest('tr'); |
||
51 | var row = api.row(tr); |
||
52 | |||
53 | if (row.child.isShown()) { |
||
54 | row.child.hide(); |
||
55 | tr.removeClass('shown'); |
||
56 | } else { |
||
57 | row.child(dtFormatLogDetails(row.data().properties)).show(); |
||
58 | tr.addClass('shown'); |
||
59 | } |
||
60 | }); |
||
61 | }", |
||
62 | 'buttons' => [ |
||
63 | 'print', 'reset', 'reload', 'export', |
||
64 | ['extend' => 'colvis', 'text' => '<i class="fa fa-columns"></i> '.trans('cortex/foundation::common.columns').' <span class="caret"/>'], |
||
65 | ['extend' => 'pageLength', 'text' => '<i class="fa fa-list-ol"></i> '.trans('cortex/foundation::common.limit').' <span class="caret"/>'], |
||
66 | ], |
||
67 | ]; |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Get columns. |
||
72 | * |
||
73 | * @return array |
||
74 | */ |
||
75 | protected function getColumns() |
||
84 | } |
||
85 |
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.