@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param WysiwygFilterInterface|null $filter |
46 | 46 | * @param array $config |
47 | 47 | */ |
48 | - public function __construct($id, $name = null, WysiwygFilterInterface $filter = null, array $config = []) |
|
48 | + public function __construct($id, $name = null, WysiwygFilterInterface $filter = null, array $config = [ ]) |
|
49 | 49 | { |
50 | 50 | $this->id = $id; |
51 | 51 | $this->name = is_null($name) ? studly_case($id) : $name; |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | |
141 | 141 | public function __call($method, $arguments) |
142 | 142 | { |
143 | - if (in_array($method, ['js', 'css'])) { |
|
144 | - call_user_func_array([$this->getPackage(), $method], $arguments); |
|
143 | + if (in_array($method, [ 'js', 'css' ])) { |
|
144 | + call_user_func_array([ $this->getPackage(), $method ], $arguments); |
|
145 | 145 | |
146 | 146 | return $this; |
147 | 147 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | public function register() |
23 | 23 | { |
24 | - $this->app->singleton('sleeping_owl', function () { |
|
24 | + $this->app->singleton('sleeping_owl', function() { |
|
25 | 25 | return new Admin(); |
26 | 26 | }); |
27 | 27 | |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | $this->registerWysiwyg(); |
32 | 32 | $this->registerAliases(); |
33 | 33 | |
34 | - $this->app->booted(function () { |
|
34 | + $this->app->booted(function() { |
|
35 | 35 | $this->registerCustomRoutes(); |
36 | 36 | $this->registerDefaultRoutes(); |
37 | 37 | $this->registerNavigationFile(); |
38 | 38 | }); |
39 | 39 | |
40 | - ModelConfigurationManager::setEventDispatcher($this->app['events']); |
|
40 | + ModelConfigurationManager::setEventDispatcher($this->app[ 'events' ]); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected function getConfig($key) |
49 | 49 | { |
50 | - return $this->app['config']->get('sleeping_owl.'.$key); |
|
50 | + return $this->app[ 'config' ]->get('sleeping_owl.'.$key); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function getBootstrapPath($path = null) |
59 | 59 | { |
60 | - if (! is_null($path)) { |
|
60 | + if (!is_null($path)) { |
|
61 | 61 | $path = DIRECTORY_SEPARATOR.$path; |
62 | 62 | } |
63 | 63 | |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | |
67 | 67 | public function boot() |
68 | 68 | { |
69 | - $this->app->singleton('sleeping_owl.template', function () { |
|
70 | - return $this->app['sleeping_owl']->template(); |
|
69 | + $this->app->singleton('sleeping_owl.template', function() { |
|
70 | + return $this->app[ 'sleeping_owl' ]->template(); |
|
71 | 71 | }); |
72 | 72 | |
73 | 73 | $this->registerBootstrap(); |
74 | 74 | |
75 | - $this->registerRoutes(function (Router $route) { |
|
76 | - $route->group(['as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers'], function ($route) { |
|
75 | + $this->registerRoutes(function(Router $route) { |
|
76 | + $route->group([ 'as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers' ], function($route) { |
|
77 | 77 | $route->get('assets/admin.scripts', [ |
78 | 78 | 'as' => 'scripts', |
79 | 79 | 'uses' => 'AdminController@getScripts', |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | $this->app->bind(\KodiComponents\Navigation\Contracts\PageInterface::class, \SleepingOwl\Admin\Navigation\Page::class); |
92 | 92 | $this->app->bind(\KodiComponents\Navigation\Contracts\BadgeInterface::class, \SleepingOwl\Admin\Navigation\Badge::class); |
93 | 93 | |
94 | - $this->app->singleton('sleeping_owl.navigation', function () { |
|
94 | + $this->app->singleton('sleeping_owl.navigation', function() { |
|
95 | 95 | return new \SleepingOwl\Admin\Navigation(); |
96 | 96 | }); |
97 | 97 | } |
98 | 98 | |
99 | 99 | protected function registerWysiwyg() |
100 | 100 | { |
101 | - $this->app->singleton('sleeping_owl.wysiwyg', function () { |
|
101 | + $this->app->singleton('sleeping_owl.wysiwyg', function() { |
|
102 | 102 | return new \SleepingOwl\Admin\Wysiwyg\Manager(); |
103 | 103 | }); |
104 | 104 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $directory = $this->getBootstrapPath(); |
112 | 112 | |
113 | - if (! is_dir($directory)) { |
|
113 | + if (!is_dir($directory)) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | ->name('/^.+\.php$/') |
120 | 120 | ->notName('routes.php') |
121 | 121 | ->notName('navigation.php') |
122 | - ->in($directory)->sort(function ($a) { |
|
122 | + ->in($directory)->sort(function($a) { |
|
123 | 123 | return $a->getFilename() != 'bootstrap.php'; |
124 | 124 | }); |
125 | 125 | |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | |
131 | 131 | protected function registerAliases() |
132 | 132 | { |
133 | - AliasLoader::getInstance(config('sleeping_owl.aliases', [])); |
|
133 | + AliasLoader::getInstance(config('sleeping_owl.aliases', [ ])); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | protected function registerCustomRoutes() |
137 | 137 | { |
138 | 138 | if (file_exists($file = $this->getBootstrapPath('routes.php'))) { |
139 | - $this->registerRoutes(function (Router $route) use ($file) { |
|
139 | + $this->registerRoutes(function(Router $route) use ($file) { |
|
140 | 140 | require $file; |
141 | 141 | }); |
142 | 142 | } |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | |
145 | 145 | protected function registerDefaultRoutes() |
146 | 146 | { |
147 | - $this->registerRoutes(function (Router $router) { |
|
147 | + $this->registerRoutes(function(Router $router) { |
|
148 | 148 | $router->pattern('adminModelId', '[a-zA-Z0-9_-]+'); |
149 | 149 | |
150 | - $aliases = $this->app['sleeping_owl']->modelAliases(); |
|
150 | + $aliases = $this->app[ 'sleeping_owl' ]->modelAliases(); |
|
151 | 151 | |
152 | 152 | if (count($aliases) > 0) { |
153 | 153 | $router->pattern('adminModel', implode('|', $aliases)); |
154 | 154 | |
155 | - $this->app['router']->bind('adminModel', function ($model, \Illuminate\Routing\Route $route) use ($aliases) { |
|
155 | + $this->app[ 'router' ]->bind('adminModel', function($model, \Illuminate\Routing\Route $route) use ($aliases) { |
|
156 | 156 | $class = array_search($model, $aliases); |
157 | 157 | |
158 | 158 | if ($class === false) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | /** @var ModelConfiguration $model */ |
163 | - $model = $this->app['sleeping_owl']->getModel($class); |
|
163 | + $model = $this->app[ 'sleeping_owl' ]->getModel($class); |
|
164 | 164 | |
165 | 165 | if ($model->hasCustomControllerClass() && $route->getActionName() !== 'Closure') { |
166 | 166 | list($controller, $action) = explode('@', $route->getActionName(), 2); |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | */ |
190 | 190 | protected function registerRoutes(\Closure $callback) |
191 | 191 | { |
192 | - $this->app['router']->group([ |
|
192 | + $this->app[ 'router' ]->group([ |
|
193 | 193 | 'prefix' => $this->getConfig('url_prefix'), |
194 | 194 | 'middleware' => $this->getConfig('middleware'), |
195 | - ], function ($route) use ($callback) { |
|
195 | + ], function($route) use ($callback) { |
|
196 | 196 | call_user_func($callback, $route); |
197 | 197 | }); |
198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $items = include $navigation; |
204 | 204 | |
205 | 205 | if (is_array($items)) { |
206 | - $this->app['sleeping_owl.navigation']->setFromArray($items); |
|
206 | + $this->app[ 'sleeping_owl.navigation' ]->setFromArray($items); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | $relationName = implode('.', $parts); |
39 | 39 | } |
40 | 40 | |
41 | - if (! is_null($relationName)) { |
|
42 | - $query->whereHas($relationName, function ($q) use ($name, $value) { |
|
41 | + if (!is_null($relationName)) { |
|
42 | + $query->whereHas($relationName, function($q) use ($name, $value) { |
|
43 | 43 | $this->buildQuery($q, $name, $value); |
44 | 44 | }); |
45 | 45 | } else { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->setName($name); |
38 | 38 | $this->setAlias($name); |
39 | 39 | |
40 | - if (! is_null($title)) { |
|
40 | + if (!is_null($title)) { |
|
41 | 41 | $this->setTitle($title); |
42 | 42 | } |
43 | 43 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return call_user_func($this->title, $this->getValue()); |
104 | 104 | } |
105 | 105 | |
106 | - return strtr($this->title, [':value' => $this->getValue()]); |
|
106 | + return strtr($this->title, [ ':value' => $this->getValue() ]); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -143,6 +143,6 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function isActive() |
145 | 145 | { |
146 | - return ! is_null($this->getValue()); |
|
146 | + return !is_null($this->getValue()); |
|
147 | 147 | } |
148 | 148 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct(Closure $callback = null) |
26 | 26 | { |
27 | - if (! is_null($callback)) { |
|
27 | + if (!is_null($callback)) { |
|
28 | 28 | $this->setCallback($callback); |
29 | 29 | } |
30 | 30 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $this->initializeElements(); |
45 | 45 | |
46 | - $activeTabs = $this->getTabs()->filter(function (TabInterface $tab) { |
|
46 | + $activeTabs = $this->getTabs()->filter(function(TabInterface $tab) { |
|
47 | 47 | return $tab->isActive(); |
48 | 48 | })->count(); |
49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function setModelClass($class) |
59 | 59 | { |
60 | - $this->getTabs()->each(function (TabInterface $tab) use ($class) { |
|
60 | + $this->getTabs()->each(function(TabInterface $tab) use ($class) { |
|
61 | 61 | if ($tab instanceof DisplayInterface) { |
62 | 62 | $tab->setModelClass($class); |
63 | 63 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function setAction($action) |
139 | 139 | { |
140 | - $this->getTabs()->each(function (TabInterface $tab) use ($action) { |
|
140 | + $this->getTabs()->each(function(TabInterface $tab) use ($action) { |
|
141 | 141 | if ($tab instanceof FormInterface) { |
142 | 142 | $tab->setAction($action); |
143 | 143 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function setId($id) |
151 | 151 | { |
152 | - $this->getTabs()->each(function (TabInterface $tab) use ($id) { |
|
152 | + $this->getTabs()->each(function(TabInterface $tab) use ($id) { |
|
153 | 153 | if ($tab instanceof FormInterface) { |
154 | 154 | $tab->setId($id); |
155 | 155 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | foreach ($this->getTabs() as $tab) { |
167 | 167 | if ($tab instanceof FormInterface) { |
168 | 168 | $result = $tab->validateForm($model); |
169 | - if (! is_null($result)) { |
|
169 | + if (!is_null($result)) { |
|
170 | 170 | return $result; |
171 | 171 | } |
172 | 172 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function saveForm(ModelConfigurationInterface $model) |
180 | 180 | { |
181 | - $this->getTabs()->each(function (TabInterface $tab) use ($model) { |
|
181 | + $this->getTabs()->each(function(TabInterface $tab) use ($model) { |
|
182 | 182 | if ($tab instanceof FormInterface) { |
183 | 183 | $tab->saveForm($model); |
184 | 184 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function fireDisplay() |
34 | 34 | { |
35 | - if (! method_exists($this, 'onDisplay')) { |
|
35 | + if (!method_exists($this, 'onDisplay')) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | - $display = app()->call([$this, 'onDisplay']); |
|
39 | + $display = app()->call([ $this, 'onDisplay' ]); |
|
40 | 40 | |
41 | 41 | if ($display instanceof DisplayInterface) { |
42 | 42 | $display->setModelClass($this->getClass()); |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function fireCreate() |
53 | 53 | { |
54 | - if (! method_exists($this, 'onCreate')) { |
|
54 | + if (!method_exists($this, 'onCreate')) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - $form = app()->call([$this, 'onCreate']); |
|
58 | + $form = app()->call([ $this, 'onCreate' ]); |
|
59 | 59 | if ($form instanceof DisplayInterface) { |
60 | 60 | $form->setModelClass($this->getClass()); |
61 | 61 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function fireEdit($id) |
80 | 80 | { |
81 | - if (! method_exists($this, 'onEdit')) { |
|
81 | + if (!method_exists($this, 'onEdit')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - $form = app()->call([$this, 'onEdit'], ['id' => $id]); |
|
85 | + $form = app()->call([ $this, 'onEdit' ], [ 'id' => $id ]); |
|
86 | 86 | if ($form instanceof DisplayInterface) { |
87 | 87 | $form->setModelClass($this->getClass()); |
88 | 88 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function fireDelete($id) |
108 | 108 | { |
109 | 109 | if (method_exists($this, 'onDelete')) { |
110 | - return app()->call([$this, 'onDelete'], ['id' => $id]); |
|
110 | + return app()->call([ $this, 'onDelete' ], [ 'id' => $id ]); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function fireDestroy($id) |
120 | 120 | { |
121 | 121 | if (method_exists($this, 'onDestroy')) { |
122 | - return app()->call([$this, 'onDestroy'], ['id' => $id]); |
|
122 | + return app()->call([ $this, 'onDestroy' ], [ 'id' => $id ]); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function fireRestore($id) |
132 | 132 | { |
133 | 133 | if (method_exists($this, 'onRestore')) { |
134 | - return app()->call([$this, 'onRestore'], ['id' => $id]); |
|
134 | + return app()->call([ $this, 'onRestore' ], [ 'id' => $id ]); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function isCreatable() |
335 | 335 | { |
336 | - if (! is_callable($this->getCreate())) { |
|
336 | + if (!is_callable($this->getCreate())) { |
|
337 | 337 | return false; |
338 | 338 | } |
339 | 339 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function isEditable(Model $model) |
359 | 359 | { |
360 | - if (! is_callable($this->getEdit())) { |
|
360 | + if (!is_callable($this->getEdit())) { |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | */ |
468 | 468 | public function fireDisplay() |
469 | 469 | { |
470 | - if (! is_callable($this->display)) { |
|
470 | + if (!is_callable($this->display)) { |
|
471 | 471 | return; |
472 | 472 | } |
473 | 473 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public function fireCreate() |
487 | 487 | { |
488 | - if (! is_callable($this->create)) { |
|
488 | + if (!is_callable($this->create)) { |
|
489 | 489 | return; |
490 | 490 | } |
491 | 491 | |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function fireEdit($id) |
514 | 514 | { |
515 | - if (! is_callable($this->edit)) { |
|
515 | + if (!is_callable($this->edit)) { |
|
516 | 516 | return; |
517 | 517 | } |
518 | 518 | |
519 | - $form = app()->call($this->edit, ['id' => $id]); |
|
519 | + $form = app()->call($this->edit, [ 'id' => $id ]); |
|
520 | 520 | if ($form instanceof DisplayInterface) { |
521 | 521 | $form->setModelClass($this->getClass()); |
522 | 522 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | public function fireDelete($id) |
542 | 542 | { |
543 | 543 | if (is_callable($this->getDelete())) { |
544 | - return app()->call($this->getDelete(), [$id]); |
|
544 | + return app()->call($this->getDelete(), [ $id ]); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | public function fireDestroy($id) |
554 | 554 | { |
555 | 555 | if (is_callable($this->getDestroy())) { |
556 | - return app()->call($this->getDestroy(), [$id]); |
|
556 | + return app()->call($this->getDestroy(), [ $id ]); |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | public function fireRestore($id) |
566 | 566 | { |
567 | 567 | if (is_callable($this->getRestore())) { |
568 | - return app()->call($this->getRestore(), [$id]); |
|
568 | + return app()->call($this->getRestore(), [ $id ]); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | return $this->getRestore(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @var array |
57 | 57 | */ |
58 | - protected $validationMessages = []; |
|
58 | + protected $validationMessages = [ ]; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * @param string $path |
@@ -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 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $messages = parent::getValidationMessages(); |
286 | 286 | |
287 | 287 | foreach ($this->validationMessages as $rule => $message) { |
288 | - $messages[$this->getName().'.'.$rule] = $message; |
|
288 | + $messages[ $this->getName().'.'.$rule ] = $message; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $messages; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $rule = substr($rule, 0, $pos); |
316 | 316 | } |
317 | 317 | |
318 | - $this->validationMessages[$rule] = $message; |
|
318 | + $this->validationMessages[ $rule ] = $message; |
|
319 | 319 | |
320 | 320 | return $this; |
321 | 321 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function getValidationLabels() |
327 | 327 | { |
328 | - return [$this->getPath() => $this->getLabel()]; |
|
328 | + return [ $this->getPath() => $this->getLabel() ]; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function getValueFromRequest() |
335 | 335 | { |
336 | - if (! is_null($value = Request::old($this->getPath()))) { |
|
336 | + if (!is_null($value = Request::old($this->getPath()))) { |
|
337 | 337 | return $value; |
338 | 338 | } |
339 | 339 | |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function getValue() |
348 | 348 | { |
349 | - if (! is_null($value = $this->getValueFromRequest())) { |
|
349 | + if (!is_null($value = $this->getValueFromRequest())) { |
|
350 | 350 | return $value; |
351 | 351 | } |
352 | 352 | |
353 | 353 | $model = $this->getModel(); |
354 | 354 | $value = $this->getDefaultValue(); |
355 | 355 | |
356 | - if (is_null($model) or ! $model->exists) { |
|
356 | + if (is_null($model) or !$model->exists) { |
|
357 | 357 | return $value; |
358 | 358 | } |
359 | 359 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } |
406 | 406 | unset($rule); |
407 | 407 | |
408 | - return [$this->getPath() => $rules]; |
|
408 | + return [ $this->getPath() => $rules ]; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |