@@ -15,7 +15,7 @@ |
||
15 | 15 | public function apply($text) |
16 | 16 | { |
17 | 17 | return Blade::compileString( |
18 | - preg_replace(['/<(\?|\%)\=?(php)?/', '/(\%|\?)>/'], ['', ''], $text) |
|
18 | + preg_replace([ '/<(\?|\%)\=?(php)?/', '/(\%|\?)>/' ], [ '', '' ], $text) |
|
19 | 19 | ); |
20 | 20 | } |
21 | 21 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | $this->sort(); |
19 | 19 | |
20 | - if (! is_null($view)) { |
|
20 | + if (!is_null($view)) { |
|
21 | 21 | return view($view, [ |
22 | 22 | 'pages' => $this->getPages(), |
23 | 23 | ])->render(); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @var ModelConfigurationInterface[] |
18 | 18 | */ |
19 | - protected $models = []; |
|
19 | + protected $models = [ ]; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var TemplateInterface |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @var Page[] |
28 | 28 | */ |
29 | - protected $menuItems = []; |
|
29 | + protected $menuItems = [ ]; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @return string[] |
33 | 33 | */ |
34 | 34 | public function modelAliases() |
35 | 35 | { |
36 | - return array_map(function (ModelConfigurationInterface $model) { |
|
36 | + return array_map(function(ModelConfigurationInterface $model) { |
|
37 | 37 | return $model->getAlias(); |
38 | 38 | }, $this->getModels()); |
39 | 39 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $class = get_class($class); |
82 | 82 | } |
83 | 83 | |
84 | - if (! $this->hasModel($class)) { |
|
84 | + if (!$this->hasModel($class)) { |
|
85 | 85 | $this->registerModel($class); |
86 | 86 | } |
87 | 87 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function setModel($class, ModelConfigurationInterface $model) |
114 | 114 | { |
115 | - $this->models[$class] = $model; |
|
115 | + $this->models[ $class ] = $model; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -11,6 +11,6 @@ |
||
11 | 11 | */ |
12 | 12 | public function apply(Builder $query) |
13 | 13 | { |
14 | - call_user_func([$query, $this->getName()], $this->getValue()); |
|
14 | + call_user_func([ $query, $this->getName() ], $this->getValue()); |
|
15 | 15 | } |
16 | 16 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | */ |
55 | 55 | public function setModel($model) |
56 | 56 | { |
57 | - if (! class_exists($model)) { |
|
57 | + if (!class_exists($model)) { |
|
58 | 58 | throw new Exception("Class model [$model] not found"); |
59 | 59 | } |
60 | 60 |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @var array |
13 | 13 | */ |
14 | - protected $order = [[0, 'asc']]; |
|
14 | + protected $order = [ [ 0, 'asc' ] ]; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @var array |
18 | 18 | */ |
19 | - protected $datatableAttributes = []; |
|
19 | + protected $datatableAttributes = [ ]; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var int |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $this->setHtmlAttribute('data-order', json_encode($this->getOrder())); |
40 | 40 | |
41 | 41 | $attributes = $this->getDatatableAttributes(); |
42 | - $attributes['pageLength'] = $this->paginate; |
|
42 | + $attributes[ 'pageLength' ] = $this->paginate; |
|
43 | 43 | |
44 | - $attributes['language'] = trans('sleeping_owl::lang.table'); |
|
44 | + $attributes[ 'language' ] = trans('sleeping_owl::lang.table'); |
|
45 | 45 | |
46 | 46 | foreach ($this->getColumns()->all() as $column) { |
47 | - $attributes['columns'][] = [ |
|
47 | + $attributes[ 'columns' ][ ] = [ |
|
48 | 48 | 'orderDataType' => class_basename($column), |
49 | 49 | ]; |
50 | 50 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getDatatableAttributes() |
59 | 59 | { |
60 | - return array_merge(config('sleeping_owl.datatables', []), (array) $this->datatableAttributes); |
|
60 | + return array_merge(config('sleeping_owl.datatables', [ ]), (array) $this->datatableAttributes); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function setOrder($order) |
89 | 89 | { |
90 | - if (! is_array($order)) { |
|
90 | + if (!is_array($order)) { |
|
91 | 91 | $order = func_get_args(); |
92 | 92 | } |
93 | 93 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $params = parent::toArray(); |
124 | 124 | |
125 | - $params['order'] = $this->getOrder(); |
|
125 | + $params[ 'order' ] = $this->getOrder(); |
|
126 | 126 | |
127 | 127 | return $params; |
128 | 128 | } |
@@ -13,7 +13,6 @@ |
||
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class DisplayTable. |
16 | - |
|
17 | 16 | * @method Columns getColumns() |
18 | 17 | * @method $this setColumns(ColumnInterface $column, ... $columns) |
19 | 18 | * |
@@ -283,7 +283,7 @@ |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
286 | - * @param \Illuminate\Database\Eloquent\Builder|Builder $query |
|
286 | + * @param \Illuminate\Database\Eloquent\Builder $query |
|
287 | 287 | */ |
288 | 288 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
289 | 289 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @var array |
32 | 32 | */ |
33 | - protected $parameters = []; |
|
33 | + protected $parameters = [ ]; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @var int|null |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | parent::initialize(); |
72 | 72 | |
73 | 73 | if ($this->getModelConfiguration()->isRestorableModel()) { |
74 | - $this->setApply(function ($q) { |
|
74 | + $this->setApply(function($q) { |
|
75 | 75 | return $q->withTrashed(); |
76 | 76 | }); |
77 | 77 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function setParameter($key, $value) |
134 | 134 | { |
135 | - $this->parameters[$key] = $value; |
|
135 | + $this->parameters[ $key ] = $value; |
|
136 | 136 | |
137 | 137 | return $this; |
138 | 138 | } |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | |
179 | 179 | $params = parent::toArray(); |
180 | 180 | |
181 | - $params['creatable'] = $model->isCreatable(); |
|
182 | - $params['createUrl'] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
183 | - $params['collection'] = $this->getCollection(); |
|
181 | + $params[ 'creatable' ] = $model->isCreatable(); |
|
182 | + $params[ 'createUrl' ] = $model->getCreateUrl($this->getParameters() + Request::all()); |
|
183 | + $params[ 'collection' ] = $this->getCollection(); |
|
184 | 184 | |
185 | - $params['extensions'] = $this->getExtensions() |
|
186 | - ->filter(function (DisplayExtensionInterface $ext) { |
|
185 | + $params[ 'extensions' ] = $this->getExtensions() |
|
186 | + ->filter(function(DisplayExtensionInterface $ext) { |
|
187 | 187 | return $ext instanceof Renderable; |
188 | 188 | }) |
189 | - ->sortBy(function (DisplayExtensionInterface $extension) { |
|
189 | + ->sortBy(function(DisplayExtensionInterface $extension) { |
|
190 | 190 | return $extension->getOrder(); |
191 | 191 | }); |
192 | 192 | |
193 | - $params['newEntryButtonText'] = $this->getNewEntryButtonText(); |
|
193 | + $params[ 'newEntryButtonText' ] = $this->getNewEntryButtonText(); |
|
194 | 194 | |
195 | 195 | return $params; |
196 | 196 | } |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function getCollection() |
213 | 213 | { |
214 | - if (! $this->isInitialized()) { |
|
214 | + if (!$this->isInitialized()) { |
|
215 | 215 | throw new \Exception('Display is not initialized'); |
216 | 216 | } |
217 | 217 | |
218 | - if (! is_null($this->collection)) { |
|
218 | + if (!is_null($this->collection)) { |
|
219 | 219 | return $this->collection; |
220 | 220 | } |
221 | 221 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $this->modifyQuery($query); |
225 | 225 | |
226 | 226 | return $this->collection = $this->usePagination() |
227 | - ? $query->paginate($this->paginate, ['*'], $this->pageName) |
|
227 | + ? $query->paginate($this->paginate, [ '*' ], $this->pageName) |
|
228 | 228 | : $query->get(); |
229 | 229 | } |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
235 | 235 | { |
236 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
236 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
237 | 237 | $extension->modifyQuery($query); |
238 | 238 | }); |
239 | 239 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $this->header = app(TableHeaderColumnInterface::class); |
57 | 57 | |
58 | - if (! is_null($label)) { |
|
58 | + if (!is_null($label)) { |
|
59 | 59 | $this->setLabel($label); |
60 | 60 | } |
61 | 61 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $this->model = $model; |
160 | 160 | $append = $this->getAppends(); |
161 | 161 | |
162 | - if (! is_null($append)) { |
|
162 | + if (!is_null($append)) { |
|
163 | 163 | $append->setModel($model); |
164 | 164 | } |
165 | 165 |
@@ -89,9 +89,9 @@ |
||
89 | 89 | parent::initialize(); |
90 | 90 | |
91 | 91 | $this->getRepository() |
92 | - ->setParentField($this->getParentField()) |
|
93 | - ->setOrderField($this->getOrderField()) |
|
94 | - ->setRootParentId($this->getRootParentId()); |
|
92 | + ->setParentField($this->getParentField()) |
|
93 | + ->setOrderField($this->getOrderField()) |
|
94 | + ->setRootParentId($this->getRootParentId()); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | - * @param \Illuminate\Database\Eloquent\Builder|Builder $query |
|
292 | + * @param \Illuminate\Database\Eloquent\Builder $query |
|
293 | 293 | */ |
294 | 294 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
295 | 295 | { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
302 | - * @return \Illuminate\Foundation\Application|mixed |
|
302 | + * @return TreeRepositoryInterface |
|
303 | 303 | * @throws \Exception |
304 | 304 | */ |
305 | 305 | protected function makeRepository() |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | public static function registerRoutes(Router $router) |
24 | 24 | { |
25 | 25 | $routeName = 'admin.display.tree.reorder'; |
26 | - if (! $router->has($routeName)) { |
|
27 | - $router->post('{adminModel}/reorder', ['as' => $routeName, function (ModelConfigurationInterface $model) { |
|
26 | + if (!$router->has($routeName)) { |
|
27 | + $router->post('{adminModel}/reorder', [ 'as' => $routeName, function(ModelConfigurationInterface $model) { |
|
28 | 28 | $model->fireDisplay()->getRepository()->reorder( |
29 | 29 | Request::input('data') |
30 | 30 | ); |
31 | - }]); |
|
31 | + } ]); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $parameters = []; |
|
43 | + protected $parameters = [ ]; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var bool |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function setParameter($key, $value) |
210 | 210 | { |
211 | - $this->parameters[$key] = $value; |
|
211 | + $this->parameters[ $key ] = $value; |
|
212 | 212 | |
213 | 213 | return $this; |
214 | 214 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | 'value' => $this->getValue(), |
256 | 256 | 'creatable' => $model->isCreatable(), |
257 | 257 | 'createUrl' => $model->getCreateUrl($this->getParameters() + Request::all()), |
258 | - 'controls' => [app('sleeping_owl.table.column')->treeControl()], |
|
258 | + 'controls' => [ app('sleeping_owl.table.column')->treeControl() ], |
|
259 | 259 | ]; |
260 | 260 | } |
261 | 261 | |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function getCollection() |
275 | 275 | { |
276 | - if (! $this->isInitialized()) { |
|
276 | + if (!$this->isInitialized()) { |
|
277 | 277 | throw new \Exception('Display is not initialized'); |
278 | 278 | } |
279 | 279 | |
280 | - if (! is_null($this->collection)) { |
|
280 | + if (!is_null($this->collection)) { |
|
281 | 281 | return $this->collection; |
282 | 282 | } |
283 | 283 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
295 | 295 | { |
296 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
296 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
297 | 297 | $extension->modifyQuery($query); |
298 | 298 | }); |
299 | 299 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | { |
307 | 307 | $repository = parent::makeRepository(); |
308 | 308 | |
309 | - if (! ($repository instanceof TreeRepositoryInterface)) { |
|
309 | + if (!($repository instanceof TreeRepositoryInterface)) { |
|
310 | 310 | throw new \Exception('Repository class must be instanced of [TreeRepositoryInterface]'); |
311 | 311 | } |
312 | 312 |