@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('resources_url')) { |
|
3 | +if (!function_exists('resources_url')) { |
|
4 | 4 | /** |
5 | 5 | * @param string $path |
6 | 6 | * |
@@ -76,7 +76,7 @@ |
||
76 | 76 | /** |
77 | 77 | * Load Relations by this->name. |
78 | 78 | * @param Builder $query |
79 | - * @param $direction |
|
79 | + * @param string $direction |
|
80 | 80 | */ |
81 | 81 | protected function loadRelationOrder(Builder $query, $direction) |
82 | 82 | { |
@@ -107,7 +107,7 @@ |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | - * @return mixed |
|
110 | + * @return Badge|null |
|
111 | 111 | */ |
112 | 112 | public function getBadge() |
113 | 113 | { |
@@ -74,15 +74,15 @@ |
||
74 | 74 | { |
75 | 75 | $this->content = $content; |
76 | 76 | |
77 | - if (! is_null($label)) { |
|
77 | + if (!is_null($label)) { |
|
78 | 78 | $this->setLabel($label); |
79 | 79 | } |
80 | 80 | |
81 | - if (! is_null($icon)) { |
|
81 | + if (!is_null($icon)) { |
|
82 | 82 | $this->setIcon($icon); |
83 | 83 | } |
84 | 84 | |
85 | - if (! is_null($badge)) { |
|
85 | + if (!is_null($badge)) { |
|
86 | 86 | $this->setBadge($badge); |
87 | 87 | } |
88 | 88 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
133 | - * @return string |
|
133 | + * @return integer |
|
134 | 134 | */ |
135 | 135 | public function getMaxDepth() |
136 | 136 | { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
363 | - * @param \Illuminate\Database\Eloquent\Builder|Builder $query |
|
363 | + * @param \Illuminate\Database\Eloquent\Builder $query |
|
364 | 364 | */ |
365 | 365 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
366 | 366 | { |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * @return \Illuminate\Foundation\Application|mixed |
|
371 | + * @return TreeRepositoryInterface |
|
372 | 372 | * @throws \Exception |
373 | 373 | */ |
374 | 374 | protected function makeRepository() |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public static function registerRoutes(Router $router) |
24 | 24 | { |
25 | 25 | $routeName = 'admin.display.tree.reorder'; |
26 | - if (! $router->has($routeName)) { |
|
26 | + if (!$router->has($routeName)) { |
|
27 | 27 | $router->post('{adminModel}/reorder', |
28 | 28 | ['as' => $routeName, 'uses' => 'SleepingOwl\Admin\Http\Controllers\DisplayController@treeReorder']); |
29 | 29 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | if ($this->getParentField()) { |
119 | 119 | $repository = $repository->setParentField($this->getParentField()); |
120 | 120 | } |
121 | - if (! is_null($this->treeType)) { |
|
121 | + if (!is_null($this->treeType)) { |
|
122 | 122 | $repository->setTreeType($this->treeType); |
123 | 123 | } |
124 | 124 | |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function getCollection() |
342 | 342 | { |
343 | - if (! $this->isInitialized()) { |
|
343 | + if (!$this->isInitialized()) { |
|
344 | 344 | throw new \Exception('Display is not initialized'); |
345 | 345 | } |
346 | 346 | |
347 | - if (! is_null($this->collection)) { |
|
347 | + if (!is_null($this->collection)) { |
|
348 | 348 | return $this->collection; |
349 | 349 | } |
350 | 350 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | { |
376 | 376 | $repository = parent::makeRepository(); |
377 | 377 | |
378 | - if (! ($repository instanceof TreeRepositoryInterface)) { |
|
378 | + if (!($repository instanceof TreeRepositoryInterface)) { |
|
379 | 379 | throw new \Exception('Repository class must be instanced of [TreeRepositoryInterface]'); |
380 | 380 | } |
381 | 381 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param \Illuminate\Database\Eloquent\Collection $collection |
36 | 36 | * |
37 | - * @return mixed |
|
37 | + * @return Collection |
|
38 | 38 | */ |
39 | 39 | public function getTree(\Illuminate\Database\Eloquent\Collection $collection) |
40 | 40 | { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * Get children for simple tree type structure. |
88 | 88 | * |
89 | 89 | * @param $collection |
90 | - * @param $id |
|
90 | + * @param string $id |
|
91 | 91 | * |
92 | 92 | * @return Collection |
93 | 93 | */ |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Get Field name for search url. |
44 | - * @return mixed |
|
44 | + * @return string |
|
45 | 45 | */ |
46 | 46 | public function getFieldName() |
47 | 47 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | parent::__construct($path, $label, $options); |
32 | 32 | |
33 | - $this->setLoadOptionsQueryPreparer(function ($item, $query) { |
|
33 | + $this->setLoadOptionsQueryPreparer(function($item, $query) { |
|
34 | 34 | $repository = app(RepositoryInterface::class); |
35 | 35 | $repository->setModel($this->getModelForOptions()); |
36 | 36 | $key = $repository->getModel()->getKeyName(); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $routeName = 'admin.form.element.'.static::$route; |
82 | 82 | |
83 | - if (! $router->has($routeName)) { |
|
83 | + if (!$router->has($routeName)) { |
|
84 | 84 | $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', [ |
85 | 85 | 'as' => $routeName, |
86 | 86 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\FormElementController@multiselectSearch', |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $options = $repository->getQuery(); |
140 | 140 | $relation = $this->getModelAttributeKey(); |
141 | 141 | |
142 | - if ($this->isEmptyRelation() and ! is_null($foreignKey = $this->getForeignKey())) { |
|
142 | + if ($this->isEmptyRelation() and !is_null($foreignKey = $this->getForeignKey())) { |
|
143 | 143 | $model = $this->getModel(); |
144 | 144 | |
145 | 145 | if ($model->{$relation}() instanceof HasOneOrMany) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | // call the pre load options query preparer if has be set |
157 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
157 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
158 | 158 | $options = $preparer($this, $options); |
159 | 159 | } |
160 | 160 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | // iterate for all options and redefine it as |
174 | 174 | // list of KEY and TEXT pair |
175 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
175 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
176 | 176 | // get the KEY and make the display text |
177 | 177 | return [data_get($opt, $key), $makeDisplay($opt)]; |
178 | 178 | }, $options); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | $attribute = $this->getModelAttributeKey(); |
201 | 201 | |
202 | - if (! method_exists($this->getModel(), $attribute)) { |
|
202 | + if (!method_exists($this->getModel(), $attribute)) { |
|
203 | 203 | return; |
204 | 204 | } |
205 | 205 |
@@ -181,7 +181,7 @@ |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
184 | - * @param mixed $defaultValue |
|
184 | + * @param string $defaultValue |
|
185 | 185 | * |
186 | 186 | * @return $this |
187 | 187 | */ |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $name = array_shift($parts); |
86 | 86 | |
87 | - while (! empty($parts)) { |
|
87 | + while (!empty($parts)) { |
|
88 | 88 | $part = array_shift($parts); |
89 | 89 | $name .= "[$part]"; |
90 | 90 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | { |
238 | 238 | $this->addValidationRule('_unique'); |
239 | 239 | |
240 | - if (! is_null($message)) { |
|
240 | + if (!is_null($message)) { |
|
241 | 241 | $this->addValidationMessage('unique', $message); |
242 | 242 | } |
243 | 243 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function getValueFromRequest(\Illuminate\Http\Request $request) |
347 | 347 | { |
348 | - if ($request->hasSession() && ! is_null($value = $request->old($this->getPath()))) { |
|
348 | + if ($request->hasSession() && !is_null($value = $request->old($this->getPath()))) { |
|
349 | 349 | return $value; |
350 | 350 | } |
351 | 351 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function getValueFromModel() |
359 | 359 | { |
360 | - if (! is_null($value = $this->getValueFromRequest(request()))) { |
|
360 | + if (!is_null($value = $this->getValueFromRequest(request()))) { |
|
361 | 361 | return $value; |
362 | 362 | } |
363 | 363 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $path = $this->getPath(); |
366 | 366 | $value = $this->getDefaultValue(); |
367 | 367 | |
368 | - if (is_null($model) or ! $model->exists) { |
|
368 | + if (is_null($model) or !$model->exists) { |
|
369 | 369 | return $value; |
370 | 370 | } |
371 | 371 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | if ($count === 1) { |
376 | 376 | $attribute = $model->getAttribute($this->getModelAttributeKey()); |
377 | 377 | |
378 | - if (! empty($attribute) || $attribute === 0 || is_null($value)) { |
|
378 | + if (!empty($attribute) || $attribute === 0 || is_null($value)) { |
|
379 | 379 | return $attribute; |
380 | 380 | } |
381 | 381 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | if ($count === 2) { |
390 | 390 | $attribute = $model->getAttribute($relation); |
391 | 391 | |
392 | - if (! empty($attribute) or is_null($value)) { |
|
392 | + if (!empty($attribute) or is_null($value)) { |
|
393 | 393 | return $attribute; |
394 | 394 | } |
395 | 395 | } |
@@ -101,7 +101,7 @@ |
||
101 | 101 | */ |
102 | 102 | public function assetPath($path = null) |
103 | 103 | { |
104 | - return ! is_null($path) ? $this->assetDir().'/'.ltrim($path, '/') : $this->assetDir(); |
|
104 | + return !is_null($path) ? $this->assetDir().'/'.ltrim($path, '/') : $this->assetDir(); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function can($action, Model $model) |
206 | 206 | { |
207 | - if (! $this->checkAccess) { |
|
207 | + if (!$this->checkAccess) { |
|
208 | 208 | return true; |
209 | 209 | } |
210 | 210 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function isCreatable() |
218 | 218 | { |
219 | - if (! is_callable($this->getCreate())) { |
|
219 | + if (!is_callable($this->getCreate())) { |
|
220 | 220 | return false; |
221 | 221 | } |
222 | 222 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function isEditable(Model $model) |
242 | 242 | { |
243 | - if (! is_callable($this->getEdit())) { |
|
243 | + if (!is_callable($this->getEdit())) { |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | public function fireDisplay(array $payload = []) |
365 | 365 | { |
366 | - if (! is_callable($this->getDisplay())) { |
|
366 | + if (!is_callable($this->getDisplay())) { |
|
367 | 367 | return; |
368 | 368 | } |
369 | 369 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | */ |
410 | 410 | public function fireCreate() |
411 | 411 | { |
412 | - if (! is_callable($this->getCreate())) { |
|
412 | + if (!is_callable($this->getCreate())) { |
|
413 | 413 | return; |
414 | 414 | } |
415 | 415 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | public function fireEdit($id) |
458 | 458 | { |
459 | - if (! is_callable($this->getEdit())) { |
|
459 | + if (!is_callable($this->getEdit())) { |
|
460 | 460 | return; |
461 | 461 | } |
462 | 462 |