1 | <?php |
||
24 | class DisplayTable extends Display |
||
25 | { |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $view = 'display.table'; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $parameters = []; |
||
35 | |||
36 | /** |
||
37 | * @var int|null |
||
38 | */ |
||
39 | protected $paginate = 25; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $pageName = 'page'; |
||
45 | |||
46 | /** |
||
47 | * @var Collection |
||
48 | */ |
||
49 | protected $collection; |
||
50 | |||
51 | /** |
||
52 | * @var string|null |
||
53 | */ |
||
54 | protected $newEntryButtonText; |
||
55 | |||
56 | /** |
||
57 | * Display constructor. |
||
58 | */ |
||
59 | public function __construct() |
||
60 | { |
||
61 | parent::__construct(); |
||
62 | |||
63 | $this->extend('columns', new Columns()); |
||
64 | $this->extend('column_filters', new ColumnFilters()); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Initialize display. |
||
69 | */ |
||
70 | public function initialize() |
||
71 | { |
||
72 | parent::initialize(); |
||
73 | |||
74 | if ($this->getModelConfiguration()->isRestorableModel()) { |
||
75 | $this->setApply(function ($q) { |
||
|
|||
76 | return $q->withTrashed(); |
||
77 | }); |
||
78 | } |
||
79 | |||
80 | $this->setHtmlAttribute('class', 'table table-striped'); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @return null|string |
||
85 | */ |
||
86 | public function getNewEntryButtonText() |
||
87 | { |
||
88 | if (is_null($this->newEntryButtonText)) { |
||
89 | $this->newEntryButtonText = trans('sleeping_owl::lang.table.new-entry'); |
||
90 | } |
||
91 | |||
92 | return $this->newEntryButtonText; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @param string $newEntryButtonText |
||
97 | * |
||
98 | * @return $this |
||
99 | */ |
||
100 | public function setNewEntryButtonText($newEntryButtonText) |
||
101 | { |
||
102 | $this->newEntryButtonText = $newEntryButtonText; |
||
103 | |||
104 | return $this; |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @return array |
||
109 | */ |
||
110 | public function getParameters() |
||
114 | |||
115 | /** |
||
116 | * @param array $parameters |
||
117 | * |
||
118 | * @return $this |
||
119 | */ |
||
120 | public function setParameters($parameters) |
||
126 | |||
127 | /** |
||
128 | * @param string $key |
||
129 | * @param mixed $value |
||
130 | * |
||
131 | * @return $this |
||
132 | */ |
||
133 | public function setParameter($key, $value) |
||
139 | |||
140 | /** |
||
141 | * @param int $perPage |
||
142 | * @param string $pageName |
||
143 | * |
||
144 | * @return $this |
||
145 | */ |
||
146 | public function paginate($perPage = 25, $pageName = 'page') |
||
153 | |||
154 | /** |
||
155 | * @return $this |
||
156 | */ |
||
157 | public function disablePagination() |
||
163 | |||
164 | /** |
||
165 | * @return bool |
||
166 | */ |
||
167 | public function usePagination() |
||
171 | |||
172 | /** |
||
173 | * @return array |
||
174 | */ |
||
175 | public function toArray() |
||
197 | |||
198 | /** |
||
199 | * @return Collection |
||
200 | * @throws \Exception |
||
201 | */ |
||
202 | public function getCollection() |
||
221 | |||
222 | /** |
||
223 | * Apply orders to the query. |
||
224 | * |
||
225 | * @param $query |
||
226 | */ |
||
227 | protected function applyOrders(Builder $query) |
||
252 | |||
253 | /** |
||
254 | * @param \Illuminate\Database\Eloquent\Builder|Builder $query |
||
255 | */ |
||
256 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
||
262 | } |
||
263 |
This check looks for function calls that miss required arguments.