@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | $title = $this->option('title'); |
39 | 39 | |
40 | - $this->call('vendor:publish', ['--provider' => SleepingOwlServiceProvider::class]); |
|
40 | + $this->call('vendor:publish', [ '--provider' => SleepingOwlServiceProvider::class ]); |
|
41 | 41 | |
42 | 42 | $this->publishConfig($title); |
43 | 43 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | $directory = config('sleeping_owl.bootstrapDirectory'); |
58 | 58 | |
59 | - if (! is_dir($directory)) { |
|
59 | + if (!is_dir($directory)) { |
|
60 | 60 | $this->files->makeDirectory($directory, 0755, true, true); |
61 | 61 | $this->line('<info>Admin bootstrap directory was created:</info> '.str_replace(base_path(), '', $directory)); |
62 | 62 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $file = config('sleeping_owl.bootstrapDirectory').'/navigation.php'; |
71 | 71 | |
72 | - if (! file_exists($file)) { |
|
72 | + if (!file_exists($file)) { |
|
73 | 73 | $contents = $this->files->get(__DIR__.'/stubs/navigation.stub'); |
74 | 74 | $this->files->put($file, $contents); |
75 | 75 | $this->line('<info>Menu file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | protected function createBootstrapFile() |
83 | 83 | { |
84 | 84 | $file = config('sleeping_owl.bootstrapDirectory').'/bootstrap.php'; |
85 | - if (! file_exists($file)) { |
|
85 | + if (!file_exists($file)) { |
|
86 | 86 | $contents = $this->files->get(__DIR__.'/stubs/bootstrap.stub'); |
87 | 87 | $this->files->put($file, $contents); |
88 | 88 | $this->line('<info>Bootstrap file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | protected function createRoutesFile() |
101 | 101 | { |
102 | 102 | $file = config('sleeping_owl.bootstrapDirectory').'/routes.php'; |
103 | - if (! file_exists($file)) { |
|
103 | + if (!file_exists($file)) { |
|
104 | 104 | $contents = $this->files->get(__DIR__.'/stubs/routes.stub'); |
105 | 105 | $this->files->put($file, $contents); |
106 | 106 | $this->line('<info>Bootstrap file was created:</info> '.str_replace(base_path(), '', $file)); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | protected function createPublicDefaultStructure() |
114 | 114 | { |
115 | 115 | $uploadsDirectory = public_path('images/uploads'); |
116 | - if (! is_dir($uploadsDirectory)) { |
|
116 | + if (!is_dir($uploadsDirectory)) { |
|
117 | 117 | $this->files->makeDirectory($uploadsDirectory, 0755, true, true); |
118 | 118 | } |
119 | 119 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $file = config_path('sleeping_owl.php'); |
129 | 129 | |
130 | - if (! is_null($title)) { |
|
130 | + if (!is_null($title)) { |
|
131 | 131 | $contents = $this->files->get($file); |
132 | 132 | $contents = str_replace('Sleeping Owl administrator', $title, $contents); |
133 | 133 | $this->files->put($file, $contents); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | protected function getOptions() |
142 | 142 | { |
143 | 143 | return [ |
144 | - ['title', null, InputOption::VALUE_REQUIRED, 'Title for admin module.'], |
|
144 | + [ 'title', null, InputOption::VALUE_REQUIRED, 'Title for admin module.' ], |
|
145 | 145 | ]; |
146 | 146 | } |
147 | 147 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $file = app_path('Providers/AdminSectionsServiceProvider.php'); |
32 | 32 | $ns = rtrim($this->getLaravel()->getNamespace(), '\\'); |
33 | 33 | |
34 | - if (! file_exists($file)) { |
|
34 | + if (!file_exists($file)) { |
|
35 | 35 | $contents = str_replace( |
36 | 36 | '__NAMESPACE__', |
37 | 37 | $ns, |
@@ -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 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | return $this->getContent()->getValidationRules(); |
298 | 298 | } |
299 | 299 | |
300 | - return []; |
|
300 | + return [ ]; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | return $this->getContent()->getValidationMessages(); |
310 | 310 | } |
311 | 311 | |
312 | - return []; |
|
312 | + return [ ]; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | return $this->getContent()->getValidationLabels(); |
322 | 322 | } |
323 | 323 | |
324 | - return []; |
|
324 | + return [ ]; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -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 | } |