@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | parent::__construct($path, $label); |
25 | 25 | |
26 | - $this->setLoadOptionsQueryPreparer(function ($item, $query) { |
|
26 | + $this->setLoadOptionsQueryPreparer(function($item, $query) { |
|
27 | 27 | $repository = app(RepositoryInterface::class); |
28 | 28 | $repository->setModel($this->getModelForOptions()); |
29 | 29 | $key = $repository->getModel()->getKeyName(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $routeName = 'admin.form.element.'.static::$route; |
41 | 41 | |
42 | - if (! $router->has($routeName)) { |
|
42 | + if (!$router->has($routeName)) { |
|
43 | 43 | $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', [ |
44 | 44 | 'as' => $routeName, |
45 | 45 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\FormElementController@selectSearch', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $routeName = 'admin.form.element.'.static::$route; |
29 | 29 | |
30 | - if (! $router->has($routeName)) { |
|
30 | + if (!$router->has($routeName)) { |
|
31 | 31 | $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', [ |
32 | 32 | 'as' => $routeName, |
33 | 33 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\UploadController@fromField', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function getUploadPath(UploadedFile $file) |
129 | 129 | { |
130 | - if (! is_callable($this->uploadPath)) { |
|
130 | + if (!is_callable($this->uploadPath)) { |
|
131 | 131 | return $this->defaultUploadPath($file); |
132 | 132 | } |
133 | 133 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function getUploadFileName(UploadedFile $file) |
155 | 155 | { |
156 | - if (! is_callable($this->uploadFileName)) { |
|
156 | + if (!is_callable($this->uploadFileName)) { |
|
157 | 157 | return $this->defaultUploadFilename($file); |
158 | 158 | } |
159 | 159 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | $name = array_shift($parts); |
84 | 84 | |
85 | - while (! empty($parts)) { |
|
85 | + while (!empty($parts)) { |
|
86 | 86 | $part = array_shift($parts); |
87 | 87 | $name .= "[$part]"; |
88 | 88 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $this->addValidationRule('_unique'); |
237 | 237 | |
238 | - if (! is_null($message)) { |
|
238 | + if (!is_null($message)) { |
|
239 | 239 | $this->addValidationMessage('unique', $message); |
240 | 240 | } |
241 | 241 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | */ |
344 | 344 | public function getValueFromRequest(\Illuminate\Http\Request $request) |
345 | 345 | { |
346 | - if ($request->hasSession() && ! is_null($value = $request->old($this->getPath()))) { |
|
346 | + if ($request->hasSession() && !is_null($value = $request->old($this->getPath()))) { |
|
347 | 347 | return $value; |
348 | 348 | } |
349 | 349 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function getValueFromModel() |
357 | 357 | { |
358 | - if (! is_null($value = $this->getValueFromRequest(request()))) { |
|
358 | + if (!is_null($value = $this->getValueFromRequest(request()))) { |
|
359 | 359 | return $value; |
360 | 360 | } |
361 | 361 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $path = $this->getPath(); |
364 | 364 | $value = $this->getDefaultValue(); |
365 | 365 | |
366 | - if (is_null($model) or ! $model->exists) { |
|
366 | + if (is_null($model) or !$model->exists) { |
|
367 | 367 | return $value; |
368 | 368 | } |
369 | 369 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | if ($count === 1) { |
374 | 374 | $attribute = $model->getAttribute($this->getModelAttributeKey()); |
375 | 375 | |
376 | - if (! empty($attribute) or is_null($value)) { |
|
376 | + if (!empty($attribute) or is_null($value)) { |
|
377 | 377 | return $attribute; |
378 | 378 | } |
379 | 379 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | if ($count === 2) { |
388 | 388 | $attribute = $model->getAttribute($relation); |
389 | 389 | |
390 | - if (! empty($attribute) or is_null($value)) { |
|
390 | + if (!empty($attribute) or is_null($value)) { |
|
391 | 391 | return $attribute; |
392 | 392 | } |
393 | 393 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function can($action, Model $model) |
205 | 205 | { |
206 | - if (! $this->checkAccess) { |
|
206 | + if (!$this->checkAccess) { |
|
207 | 207 | return true; |
208 | 208 | } |
209 | 209 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function isCreatable() |
217 | 217 | { |
218 | - if (! is_callable($this->getCreate())) { |
|
218 | + if (!is_callable($this->getCreate())) { |
|
219 | 219 | return false; |
220 | 220 | } |
221 | 221 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function isEditable(Model $model) |
241 | 241 | { |
242 | - if (! is_callable($this->getEdit())) { |
|
242 | + if (!is_callable($this->getEdit())) { |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public function fireDisplay() |
363 | 363 | { |
364 | - if (! is_callable($this->getDisplay())) { |
|
364 | + if (!is_callable($this->getDisplay())) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function fireCreate() |
404 | 404 | { |
405 | - if (! is_callable($this->getCreate())) { |
|
405 | + if (!is_callable($this->getCreate())) { |
|
406 | 406 | return; |
407 | 407 | } |
408 | 408 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | */ |
450 | 450 | public function fireEdit($id) |
451 | 451 | { |
452 | - if (! is_callable($this->getEdit())) { |
|
452 | + if (!is_callable($this->getEdit())) { |
|
453 | 453 | return; |
454 | 454 | } |
455 | 455 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | protected function registerModelBindings(Collection $aliases) |
60 | 60 | { |
61 | - $this->router->bind('adminModel', function ($model, Route $route) use ($aliases) { |
|
61 | + $this->router->bind('adminModel', function($model, Route $route) use ($aliases) { |
|
62 | 62 | if (is_null($model = $aliases->get($model))) { |
63 | 63 | throw new ModelNotFoundException(); |
64 | 64 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function runCustomController(Route $route, $controller, $action) |
81 | 81 | { |
82 | - $route->uses(function () use ($route, $controller, $action) { |
|
82 | + $route->uses(function() use ($route, $controller, $action) { |
|
83 | 83 | return (new \Illuminate\Routing\ControllerDispatcher($this->app))->dispatch( |
84 | 84 | $route, $this->app->make($controller), $action |
85 | 85 | ); |
@@ -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 \KodiCMS\Assets\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 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | $this->registerMessages(); |
109 | 109 | $this->registerBootstrap(); |
110 | 110 | |
111 | - $this->registerRoutes(function (Router $route) { |
|
112 | - $route->group(['as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers'], function ($route) { |
|
111 | + $this->registerRoutes(function(Router $route) { |
|
112 | + $route->group(['as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers'], function($route) { |
|
113 | 113 | $route->get('assets/admin.scripts', [ |
114 | 114 | 'as' => 'scripts', |
115 | 115 | 'uses' => 'AdminController@getScripts', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $this->app[WidgetsRegistryInterface::class]->registerWidget($messageType); |
131 | 131 | } |
132 | 132 | |
133 | - $this->app->singleton('sleeping_owl.message', function () use ($messageTypes) { |
|
133 | + $this->app->singleton('sleeping_owl.message', function() use ($messageTypes) { |
|
134 | 134 | return new \SleepingOwl\Admin\Widgets\Messages\MessageStack($messageTypes); |
135 | 135 | }); |
136 | 136 | } |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | $this->app->bind(\KodiComponents\Navigation\Contracts\PageInterface::class, \SleepingOwl\Admin\Navigation\Page::class); |
145 | 145 | $this->app->bind(\KodiComponents\Navigation\Contracts\BadgeInterface::class, \SleepingOwl\Admin\Navigation\Badge::class); |
146 | 146 | |
147 | - $this->app->singleton('sleeping_owl.navigation', function () { |
|
147 | + $this->app->singleton('sleeping_owl.navigation', function() { |
|
148 | 148 | return new \SleepingOwl\Admin\Navigation(); |
149 | 149 | }); |
150 | 150 | } |
151 | 151 | |
152 | 152 | protected function registerWysiwyg() |
153 | 153 | { |
154 | - $this->app->singleton('sleeping_owl.wysiwyg', function () { |
|
154 | + $this->app->singleton('sleeping_owl.wysiwyg', function() { |
|
155 | 155 | return new \SleepingOwl\Admin\Wysiwyg\Manager($this->app); |
156 | 156 | }); |
157 | 157 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | $directory = $this->getBootstrapPath(); |
165 | 165 | |
166 | - if (! is_dir($directory)) { |
|
166 | + if (!is_dir($directory)) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | ->notName('routes.php') |
174 | 174 | ->notName('navigation.php') |
175 | 175 | ->in($directory) |
176 | - ->sort(function ($a) { |
|
176 | + ->sort(function($a) { |
|
177 | 177 | return $a->getFilename() != 'bootstrap.php'; |
178 | 178 | }); |
179 | 179 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | protected function registerCustomRoutes() |
191 | 191 | { |
192 | 192 | if (file_exists($file = $this->getBootstrapPath('routes.php'))) { |
193 | - $this->registerRoutes(function (Router $route) use ($file) { |
|
193 | + $this->registerRoutes(function(Router $route) use ($file) { |
|
194 | 194 | require $file; |
195 | 195 | }); |
196 | 196 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | protected function registerDefaultRoutes() |
200 | 200 | { |
201 | - $this->registerRoutes(function (Router $router) { |
|
201 | + $this->registerRoutes(function(Router $router) { |
|
202 | 202 | (new ModelRouter($this->app, $router))->register($this->app['sleeping_owl']->getModels()); |
203 | 203 | |
204 | 204 | if (file_exists($routesFile = __DIR__.'/../Http/routes.php')) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->app['router']->group([ |
218 | 218 | 'prefix' => $this->getConfig('url_prefix'), |
219 | 219 | 'middleware' => $this->getConfig('middleware'), |
220 | - ], function ($route) use ($callback) { |
|
220 | + ], function($route) use ($callback) { |
|
221 | 221 | call_user_func($callback, $route); |
222 | 222 | }); |
223 | 223 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function setClass($class) |
58 | 58 | { |
59 | - if (! class_exists($class)) { |
|
59 | + if (!class_exists($class)) { |
|
60 | 60 | throw new RepositoryException("Class {$class} not found."); |
61 | 61 | } |
62 | 62 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function with($with) |
105 | 105 | { |
106 | - if (! is_array($with)) { |
|
106 | + if (!is_array($with)) { |
|
107 | 107 | $with = func_get_args(); |
108 | 108 | } |
109 | 109 |
@@ -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, |