@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function __construct($treeType = null) |
42 | 42 | { |
43 | - if (! is_null($treeType)) { |
|
43 | + if (!is_null($treeType)) { |
|
44 | 44 | $this->setTreeType($treeType); |
45 | 45 | } |
46 | 46 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $this->treeType = new $treeType($this); |
56 | 56 | |
57 | - if (! ($this->treeType instanceof TreeTypeInterface)) { |
|
57 | + if (!($this->treeType instanceof TreeTypeInterface)) { |
|
58 | 58 | throw new DisplayTreeException('Tree type class must be instanced of [SleepingOwl\Admin\Contracts\Display\Tree\TreeTypeInterface]'); |
59 | 59 | } |
60 | 60 | } |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function dependentSelect(Request $request, ModelConfigurationInterface $model, $field, $id = null) |
22 | 22 | { |
23 | - if (! is_null($id)) { |
|
23 | + if (!is_null($id)) { |
|
24 | 24 | $item = $model->getRepository()->find($id); |
25 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
25 | + if (is_null($item) || !$model->isEditable($item)) { |
|
26 | 26 | return new JsonResponse([ |
27 | 27 | 'message' => trans('lang.message.access_denied'), |
28 | 28 | ], 403); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $form = $model->fireEdit($id); |
32 | 32 | } else { |
33 | - if (! $model->isCreatable()) { |
|
33 | + if (!$model->isCreatable()) { |
|
34 | 34 | return new JsonResponse([ |
35 | 35 | 'message' => trans('lang.message.access_denied'), |
36 | 36 | ], 403); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | return new JsonResponse([ |
60 | - 'output' => collect($options)->map(function ($value, $key) { |
|
60 | + 'output' => collect($options)->map(function($value, $key) { |
|
61 | 61 | return ['id' => $key, 'name' => $value]; |
62 | 62 | }), |
63 | 63 | 'selected' => $element->getValueFromModel(), |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function multiselectSearch(Request $request, ModelConfigurationInterface $model, $field, $id = null) |
76 | 76 | { |
77 | - if (! is_null($id)) { |
|
77 | + if (!is_null($id)) { |
|
78 | 78 | $item = $model->getRepository()->find($id); |
79 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
79 | + if (is_null($item) || !$model->isEditable($item)) { |
|
80 | 80 | return new JsonResponse([ |
81 | 81 | 'message' => trans('lang.message.access_denied'), |
82 | 82 | ], 403); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | $form = $model->fireEdit($id); |
86 | 86 | } else { |
87 | - if (! $model->isCreatable()) { |
|
87 | + if (!$model->isCreatable()) { |
|
88 | 88 | return new JsonResponse([ |
89 | 89 | 'message' => trans('lang.message.access_denied'), |
90 | 90 | ], 403); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | return new JsonResponse( |
108 | 108 | $model::where($request->field, 'like', "%{$request->q}%") |
109 | 109 | ->get() |
110 | - ->map(function ($item) use ($field) { |
|
110 | + ->map(function($item) use ($field) { |
|
111 | 111 | return [ |
112 | 112 | 'tag_name' => $item->{$field}, |
113 | 113 | 'id' => $item->id, |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function selectSearch(Request $request, ModelConfigurationInterface $model, $field, $id = null) |
130 | 130 | { |
131 | - if (! is_null($id)) { |
|
131 | + if (!is_null($id)) { |
|
132 | 132 | $item = $model->getRepository()->find($id); |
133 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
133 | + if (is_null($item) || !$model->isEditable($item)) { |
|
134 | 134 | return new JsonResponse([ |
135 | 135 | 'message' => trans('lang.message.access_denied'), |
136 | 136 | ], 403); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $form = $model->fireEdit($id); |
140 | 140 | } else { |
141 | - if (! $model->isCreatable()) { |
|
141 | + if (!$model->isCreatable()) { |
|
142 | 142 | return new JsonResponse([ |
143 | 143 | 'message' => trans('lang.message.access_denied'), |
144 | 144 | ], 403); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | return new JsonResponse( |
162 | 162 | $model::where($request->field, 'like', "%{$request->q}%") |
163 | 163 | ->get() |
164 | - ->map(function ($item) use ($field) { |
|
164 | + ->map(function($item) use ($field) { |
|
165 | 165 | return [ |
166 | 166 | 'tag_name' => $item->{$field}, |
167 | 167 | 'id' => $item->id, |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | $this->initializeNavigation(); |
32 | 32 | $this->registerAliases(); |
33 | 33 | |
34 | - $this->app->singleton('sleeping_owl.widgets', function () { |
|
34 | + $this->app->singleton('sleeping_owl.widgets', function() { |
|
35 | 35 | return new WidgetsRegistry($this->app); |
36 | 36 | }); |
37 | 37 | |
38 | - $this->app->booted(function () { |
|
38 | + $this->app->booted(function() { |
|
39 | 39 | $this->app['sleeping_owl.widgets']->placeWidgets( |
40 | 40 | $this->app[ViewFactory::class] |
41 | 41 | ); |
42 | 42 | }); |
43 | 43 | |
44 | - $this->app->booted(function () { |
|
44 | + $this->app->booted(function() { |
|
45 | 45 | $this->registerCustomRoutes(); |
46 | 46 | $this->registerDefaultRoutes(); |
47 | 47 | $this->registerNavigationFile(); |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | |
55 | 55 | protected function registerTemplate() |
56 | 56 | { |
57 | - $this->app->singleton('assets.packages', function ($app) { |
|
57 | + $this->app->singleton('assets.packages', function($app) { |
|
58 | 58 | return new \KodiCMS\Assets\PackageManager(); |
59 | 59 | }); |
60 | 60 | |
61 | - $this->app->singleton('sleeping_owl.meta', function ($app) { |
|
61 | + $this->app->singleton('sleeping_owl.meta', function($app) { |
|
62 | 62 | return new \SleepingOwl\Admin\Templates\Meta( |
63 | 63 | new \SleepingOwl\Admin\Templates\Assets( |
64 | 64 | $app['assets.packages'] |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | ); |
67 | 67 | }); |
68 | 68 | |
69 | - $this->app->singleton('sleeping_owl.template', function ($app) { |
|
70 | - if (! class_exists($class = $this->getConfig('template'))) { |
|
69 | + $this->app->singleton('sleeping_owl.template', function($app) { |
|
70 | + if (!class_exists($class = $this->getConfig('template'))) { |
|
71 | 71 | throw new TemplateException("Template class [{$class}] not found"); |
72 | 72 | } |
73 | 73 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function getBootstrapPath($path = null) |
98 | 98 | { |
99 | - if (! is_null($path)) { |
|
99 | + if (!is_null($path)) { |
|
100 | 100 | $path = DIRECTORY_SEPARATOR.$path; |
101 | 101 | } |
102 | 102 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $this->app[WidgetsRegistryInterface::class]->registerWidget($messageType); |
122 | 122 | } |
123 | 123 | |
124 | - $this->app->singleton('sleeping_owl.message', function () use ($messageTypes) { |
|
124 | + $this->app->singleton('sleeping_owl.message', function() use ($messageTypes) { |
|
125 | 125 | return new \SleepingOwl\Admin\Widgets\Messages\MessageStack($messageTypes); |
126 | 126 | }); |
127 | 127 | } |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | $this->app->bind(\KodiComponents\Navigation\Contracts\PageInterface::class, \SleepingOwl\Admin\Navigation\Page::class); |
136 | 136 | $this->app->bind(\KodiComponents\Navigation\Contracts\BadgeInterface::class, \SleepingOwl\Admin\Navigation\Badge::class); |
137 | 137 | |
138 | - $this->app->singleton('sleeping_owl.navigation', function () { |
|
138 | + $this->app->singleton('sleeping_owl.navigation', function() { |
|
139 | 139 | return new \SleepingOwl\Admin\Navigation(); |
140 | 140 | }); |
141 | 141 | } |
142 | 142 | |
143 | 143 | protected function registerWysiwyg() |
144 | 144 | { |
145 | - $this->app->singleton('sleeping_owl.wysiwyg', function () { |
|
145 | + $this->app->singleton('sleeping_owl.wysiwyg', function() { |
|
146 | 146 | return new \SleepingOwl\Admin\Wysiwyg\Manager($this->app); |
147 | 147 | }); |
148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | $directory = $this->getBootstrapPath(); |
156 | 156 | |
157 | - if (! is_dir($directory)) { |
|
157 | + if (!is_dir($directory)) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | ->notName('routes.php') |
165 | 165 | ->notName('navigation.php') |
166 | 166 | ->in($directory) |
167 | - ->sort(function ($a) { |
|
167 | + ->sort(function($a) { |
|
168 | 168 | return $a->getFilename() != 'bootstrap.php'; |
169 | 169 | }); |
170 | 170 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | protected function registerCustomRoutes() |
182 | 182 | { |
183 | 183 | if (file_exists($file = $this->getBootstrapPath('routes.php'))) { |
184 | - $this->registerRoutes(function (Router $route) use ($file) { |
|
184 | + $this->registerRoutes(function(Router $route) use ($file) { |
|
185 | 185 | require $file; |
186 | 186 | }); |
187 | 187 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | protected function registerDefaultRoutes() |
191 | 191 | { |
192 | - $this->registerRoutes(function (Router $router) { |
|
192 | + $this->registerRoutes(function(Router $router) { |
|
193 | 193 | (new ModelRouter($this->app, $router))->register($this->app['sleeping_owl']->getModels()); |
194 | 194 | |
195 | 195 | if (file_exists($routesFile = __DIR__.'/../Http/routes.php')) { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $this->app['router']->group([ |
209 | 209 | 'prefix' => $this->getConfig('url_prefix'), |
210 | 210 | 'middleware' => $this->getConfig('middleware'), |
211 | - ], function ($route) use ($callback) { |
|
211 | + ], function($route) use ($callback) { |
|
212 | 212 | call_user_func($callback, $route); |
213 | 213 | }); |
214 | 214 | } |
@@ -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 | * |
@@ -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 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function fireDisplay(array $payload = []) |
35 | 35 | { |
36 | - if (! method_exists($this, 'onDisplay')) { |
|
36 | + if (!method_exists($this, 'onDisplay')) { |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function fireCreate() |
58 | 58 | { |
59 | - if (! method_exists($this, 'onCreate')) { |
|
59 | + if (!method_exists($this, 'onCreate')) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function fireEdit($id) |
85 | 85 | { |
86 | - if (! method_exists($this, 'onEdit')) { |
|
86 | + if (!method_exists($this, 'onEdit')) { |
|
87 | 87 | return; |
88 | 88 | } |
89 | 89 |
@@ -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 | } |
@@ -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 |