@@ -40,9 +40,8 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * @param bool $sortable |
|
44 | 43 | * |
45 | - * @return $this |
|
44 | + * @return string |
|
46 | 45 | */ |
47 | 46 | public function getTitle() |
48 | 47 | { |
@@ -54,7 +53,6 @@ discard block |
||
54 | 53 | } |
55 | 54 | |
56 | 55 | /** |
57 | - * @param bool $sortable |
|
58 | 56 | * |
59 | 57 | * @return $this |
60 | 58 | */ |
@@ -79,7 +77,7 @@ discard block |
||
79 | 77 | |
80 | 78 | /** |
81 | 79 | * @param $url |
82 | - * @return string |
|
80 | + * @return EditableColumn |
|
83 | 81 | */ |
84 | 82 | public function setUrl($url) |
85 | 83 | { |
@@ -98,7 +96,7 @@ discard block |
||
98 | 96 | |
99 | 97 | /** |
100 | 98 | * @param $url |
101 | - * @return string |
|
99 | + * @return EditableColumn |
|
102 | 100 | */ |
103 | 101 | public function setEditableMode($mode) |
104 | 102 | { |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace SleepingOwl\Admin\Display\Column\Editable; |
4 | 4 | |
5 | -use Illuminate\Http\Request; |
|
6 | 5 | use SleepingOwl\Admin\Display\Column\NamedColumn; |
7 | 6 | |
8 | 7 | class EditableColumn extends NamedColumn |
@@ -70,7 +70,7 @@ |
||
70 | 70 | */ |
71 | 71 | public function getUrl() |
72 | 72 | { |
73 | - if (! $this->url) { |
|
73 | + if (!$this->url) { |
|
74 | 74 | return request()->url(); |
75 | 75 | } |
76 | 76 |
@@ -99,7 +99,7 @@ |
||
99 | 99 | /** |
100 | 100 | * Get column value from instance. |
101 | 101 | * |
102 | - * @param Collection|Model|Closure $instance |
|
102 | + * @param Model $instance |
|
103 | 103 | * @param string $name |
104 | 104 | * |
105 | 105 | * @return mixed |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function setOrderable($orderable = true) |
77 | 77 | { |
78 | - if ($orderable !== false && ! $orderable instanceof OrderByClauseInterface) { |
|
79 | - if (! is_string($orderable) && ! $orderable instanceof Closure) { |
|
78 | + if ($orderable !== false && !$orderable instanceof OrderByClauseInterface) { |
|
79 | + if (!is_string($orderable) && !$orderable instanceof Closure) { |
|
80 | 80 | $orderable = $this->getName(); |
81 | 81 | } |
82 | 82 | } |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | if ($instance === null) { |
145 | 145 | $instance = collect(); |
146 | 146 | } |
147 | - } elseif (! is_null($instance)) { |
|
147 | + } elseif (!is_null($instance)) { |
|
148 | 148 | $instance = $instance->getAttribute($part); |
149 | 149 | } |
150 | 150 | |
151 | - if (! empty($parts) && ! is_null($instance)) { |
|
151 | + if (!empty($parts) && !is_null($instance)) { |
|
152 | 152 | return $this->getValueFromObject($instance, implode('.', $parts)); |
153 | 153 | } |
154 | 154 |
@@ -192,7 +192,7 @@ |
||
192 | 192 | * @deprecated 4.5.0 |
193 | 193 | * @see getElements() |
194 | 194 | * |
195 | - * @return Collection[] |
|
195 | + * @return FormElementsCollection |
|
196 | 196 | */ |
197 | 197 | public function getItems() |
198 | 198 | { |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | parent::initialize(); |
102 | 102 | |
103 | - if (! $this->hasHtmlAttribute('enctype')) { |
|
103 | + if (!$this->hasHtmlAttribute('enctype')) { |
|
104 | 104 | // Try to find upload element |
105 | - $this->getElements()->each(function ($element) { |
|
105 | + $this->getElements()->each(function($element) { |
|
106 | 106 | // Try to get nested - will be implemented |
107 | - if ($element instanceof Upload && ! $this->hasHtmlAttribute('enctype')) { |
|
107 | + if ($element instanceof Upload && !$this->hasHtmlAttribute('enctype')) { |
|
108 | 108 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
109 | 109 | } |
110 | 110 | }); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function setItems($items) |
211 | 211 | { |
212 | - if (! is_array($items)) { |
|
212 | + if (!is_array($items)) { |
|
213 | 213 | $items = func_get_args(); |
214 | 214 | } |
215 | 215 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function setId($id) |
238 | 238 | { |
239 | - if (is_null($this->id) && ! is_null($id) && ($model = $this->getRepository()->find($id))) { |
|
239 | + if (is_null($this->id) && !is_null($id) && ($model = $this->getRepository()->find($id))) { |
|
240 | 240 | $this->id = $id; |
241 | 241 | |
242 | 242 | parent::setModel($model); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public function saveForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $modelConfiguration = null) |
299 | 299 | { |
300 | - if (! $this->validModelConfiguration($modelConfiguration)) { |
|
300 | + if (!$this->validModelConfiguration($modelConfiguration)) { |
|
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | protected function saveBelongsToRelations(Model $model) |
338 | 338 | { |
339 | 339 | foreach ($model->getRelations() as $name => $relation) { |
340 | - if ($model->{$name}() instanceof BelongsTo && ! is_null($relation)) { |
|
340 | + if ($model->{$name}() instanceof BelongsTo && !is_null($relation)) { |
|
341 | 341 | $relation->save(); |
342 | 342 | $model->{$name}()->associate($relation); |
343 | 343 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | protected function saveHasOneRelations(Model $model) |
353 | 353 | { |
354 | 354 | foreach ($model->getRelations() as $name => $relation) { |
355 | - if ($model->{$name}() instanceof HasOneOrMany && ! is_null($relation)) { |
|
355 | + if ($model->{$name}() instanceof HasOneOrMany && !is_null($relation)) { |
|
356 | 356 | if (is_array($relation) || $relation instanceof \Traversable) { |
357 | 357 | $model->{$name}()->saveMany($relation); |
358 | 358 | } else { |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function validateForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $modelConfiguration = null) |
372 | 372 | { |
373 | - if (! $this->validModelConfiguration($modelConfiguration)) { |
|
373 | + if (!$this->validModelConfiguration($modelConfiguration)) { |
|
374 | 374 | return; |
375 | 375 | } |
376 | 376 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | /** |
15 | 15 | * @param ModelConfigurationInterface $model |
16 | - * @param null $id |
|
16 | + * @param integer|null $id |
|
17 | 17 | * @return JsonResponse|mixed |
18 | 18 | */ |
19 | 19 | public function getModelLogic(ModelConfigurationInterface $model, $id = null) |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function getModelLogic(ModelConfigurationInterface $model, $id = null) |
20 | 20 | { |
21 | - if (! is_null($id)) { |
|
21 | + if (!is_null($id)) { |
|
22 | 22 | $item = $model->getRepository()->find($id); |
23 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
23 | + if (is_null($item) || !$model->isEditable($item)) { |
|
24 | 24 | return new JsonResponse([ |
25 | 25 | 'message' => trans('lang.message.access_denied'), |
26 | 26 | ], 403); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return $model->fireEdit($id); |
30 | 30 | } |
31 | 31 | |
32 | - if (! $model->isCreatable()) { |
|
32 | + if (!$model->isCreatable()) { |
|
33 | 33 | return new JsonResponse([ |
34 | 34 | 'message' => trans('lang.message.access_denied'), |
35 | 35 | ], 403); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | return new JsonResponse([ |
77 | - 'output' => collect($options)->map(function ($value, $key) { |
|
77 | + 'output' => collect($options)->map(function($value, $key) { |
|
78 | 78 | return ['id' => $key, 'name' => $value]; |
79 | 79 | }), |
80 | 80 | 'selected' => $element->getValueFromModel(), |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return new JsonResponse( |
127 | 127 | $model::where($request->search, 'like', "%{$request->q}%") |
128 | 128 | ->get() |
129 | - ->map(function (Model $item) use ($field) { |
|
129 | + ->map(function(Model $item) use ($field) { |
|
130 | 130 | return [ |
131 | 131 | 'tag_name' => $item->{$field}, |
132 | 132 | 'id' => $item->id, |
@@ -108,6 +108,9 @@ |
||
108 | 108 | |
109 | 109 | protected $breadcrumbs = null; |
110 | 110 | |
111 | + /** |
|
112 | + * @param string $class |
|
113 | + */ |
|
111 | 114 | public function __construct(\Illuminate\Contracts\Foundation\Application $app, $class) |
112 | 115 | { |
113 | 116 | parent::__construct($app, $class); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Overload current page. |
17 | - * @return \KodiComponents\Navigation\Contracts\PageInterface|null |
|
17 | + * @return PageInterface |
|
18 | 18 | */ |
19 | 19 | public function getCurrentPage() |
20 | 20 | { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param Collection $pages |
53 | - * @param $url |
|
53 | + * @param string $url |
|
54 | 54 | */ |
55 | 55 | protected function findPageByAliasId(Collection $pages, $url) |
56 | 56 | { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function setAliasesId(Collection $pages) |
32 | 32 | { |
33 | - $pages->each(function (PageInterface $page) { |
|
33 | + $pages->each(function(PageInterface $page) { |
|
34 | 34 | $page->setAliasId(); |
35 | 35 | |
36 | 36 | if ($page->getPages()->count()) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function findPageByAliasId(Collection $pages, $url) |
56 | 56 | { |
57 | - $pages->each(function (PageInterface $page) use ($url) { |
|
57 | + $pages->each(function(PageInterface $page) use ($url) { |
|
58 | 58 | $urlPath = parse_url($url, PHP_URL_PATH); |
59 | 59 | |
60 | 60 | if (Route::current()) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | protected function findActivePage() |
88 | 88 | { |
89 | - if (! is_null($this->currentPage)) { |
|
89 | + if (!is_null($this->currentPage)) { |
|
90 | 90 | return true; |
91 | 91 | } |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $this->findActive($url, $foundPages); |
98 | 98 | |
99 | - if (! is_null($this->currentPage)) { |
|
99 | + if (!is_null($this->currentPage)) { |
|
100 | 100 | $this->currentPage->setActive(); |
101 | 101 | } |
102 | 102 |
@@ -94,7 +94,7 @@ |
||
94 | 94 | /** |
95 | 95 | * @param string $key |
96 | 96 | * |
97 | - * @return mixed |
|
97 | + * @return string |
|
98 | 98 | */ |
99 | 99 | protected function getConfig($key) |
100 | 100 | { |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | $this->initializeNavigation(); |
43 | 43 | $this->registerAliases(); |
44 | 44 | |
45 | - $this->app->singleton('sleeping_owl.widgets', function () { |
|
45 | + $this->app->singleton('sleeping_owl.widgets', function() { |
|
46 | 46 | return new WidgetsRegistry($this->app); |
47 | 47 | }); |
48 | 48 | |
49 | - $this->app->booted(function () { |
|
49 | + $this->app->booted(function() { |
|
50 | 50 | $this->app['sleeping_owl.widgets']->placeWidgets( |
51 | 51 | $this->app[ViewFactory::class] |
52 | 52 | ); |
53 | 53 | }); |
54 | 54 | |
55 | - $this->app->booted(function () { |
|
55 | + $this->app->booted(function() { |
|
56 | 56 | $this->registerCustomRoutes(); |
57 | 57 | $this->registerDefaultRoutes(); |
58 | 58 | $this->registerSupportRoutes(); |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | |
67 | 67 | protected function registerTemplate() |
68 | 68 | { |
69 | - $this->app->singleton('assets.packages', function ($app) { |
|
69 | + $this->app->singleton('assets.packages', function($app) { |
|
70 | 70 | return new \KodiCMS\Assets\PackageManager(); |
71 | 71 | }); |
72 | 72 | |
73 | - $this->app->singleton('sleeping_owl.meta', function ($app) { |
|
73 | + $this->app->singleton('sleeping_owl.meta', function($app) { |
|
74 | 74 | return new Meta( |
75 | 75 | new Assets( |
76 | 76 | $app['assets.packages'] |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | ); |
79 | 79 | }); |
80 | 80 | |
81 | - $this->app->singleton('sleeping_owl.template', function (Application $app) { |
|
82 | - if (! class_exists($class = $this->getConfig('template'))) { |
|
81 | + $this->app->singleton('sleeping_owl.template', function(Application $app) { |
|
82 | + if (!class_exists($class = $this->getConfig('template'))) { |
|
83 | 83 | throw new TemplateException("Template class [{$class}] not found"); |
84 | 84 | } |
85 | 85 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function getBootstrapPath($path = null) |
110 | 110 | { |
111 | - if (! is_null($path)) { |
|
111 | + if (!is_null($path)) { |
|
112 | 112 | $path = DIRECTORY_SEPARATOR.$path; |
113 | 113 | } |
114 | 114 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $this->app[WidgetsRegistryInterface::class]->registerWidget($messageType); |
137 | 137 | } |
138 | 138 | |
139 | - $this->app->singleton('sleeping_owl.message', function () use ($messageTypes) { |
|
139 | + $this->app->singleton('sleeping_owl.message', function() use ($messageTypes) { |
|
140 | 140 | return new MessageStack($messageTypes); |
141 | 141 | }); |
142 | 142 | } |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | \SleepingOwl\Admin\Navigation\Badge::class |
169 | 169 | ); |
170 | 170 | |
171 | - $this->app->singleton('sleeping_owl.navigation', function () { |
|
171 | + $this->app->singleton('sleeping_owl.navigation', function() { |
|
172 | 172 | return new Navigation(); |
173 | 173 | }); |
174 | 174 | } |
175 | 175 | |
176 | 176 | protected function registerWysiwyg() |
177 | 177 | { |
178 | - $this->app->singleton('sleeping_owl.wysiwyg', function () { |
|
178 | + $this->app->singleton('sleeping_owl.wysiwyg', function() { |
|
179 | 179 | return new Manager($this->app); |
180 | 180 | }); |
181 | 181 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | $directory = $this->getBootstrapPath(); |
189 | 189 | |
190 | - if (! is_dir($directory)) { |
|
190 | + if (!is_dir($directory)) { |
|
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | ->notName('routes.php') |
198 | 198 | ->notName('navigation.php') |
199 | 199 | ->in($directory) |
200 | - ->sort(function (SplFileInfo $a) { |
|
200 | + ->sort(function(SplFileInfo $a) { |
|
201 | 201 | return $a->getFilename() != 'bootstrap.php'; |
202 | 202 | }); |
203 | 203 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | protected function registerCustomRoutes() |
221 | 221 | { |
222 | 222 | if (file_exists($file = $this->getBootstrapPath('routes.php'))) { |
223 | - $this->registerRoutes(function (Router $route) use ($file) { |
|
223 | + $this->registerRoutes(function(Router $route) use ($file) { |
|
224 | 224 | require $file; |
225 | 225 | }); |
226 | 226 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | protected function registerDefaultRoutes() |
233 | 233 | { |
234 | - $this->registerRoutes(function (Router $router) { |
|
234 | + $this->registerRoutes(function(Router $router) { |
|
235 | 235 | (new ModelRouter($this->app, $router))->register($this->app['sleeping_owl']->getModels()); |
236 | 236 | |
237 | 237 | if (file_exists($routesFile = __DIR__.'/../Http/routes.php')) { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $this->app['router']->group([ |
251 | 251 | 'prefix' => $this->getConfig('url_prefix'), |
252 | 252 | |
253 | - ], function (Router $route) { |
|
253 | + ], function(Router $route) { |
|
254 | 254 | $route->get('ckeditor/upload/image', [ |
255 | 255 | 'as' => 'admin.ckeditor.upload', |
256 | 256 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\UploadController@ckEditorStore', |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $this->app['router']->group([ |
272 | 272 | 'prefix' => $this->getConfig('url_prefix'), |
273 | 273 | 'middleware' => $this->getConfig('middleware'), |
274 | - ], function (Router $route) use ($callback) { |
|
274 | + ], function(Router $route) use ($callback) { |
|
275 | 275 | call_user_func($callback, $route); |
276 | 276 | }); |
277 | 277 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getModelConfiguration() |
59 | 59 | { |
60 | - if (! $this->hasModel()) { |
|
60 | + if (!$this->hasModel()) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function hasModel() |
71 | 71 | { |
72 | - return ! is_null($this->model) && class_exists($this->model); |
|
72 | + return !is_null($this->model) && class_exists($this->model); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getAccessLogic() |
115 | 115 | { |
116 | - if (! is_callable($this->accessLogic)) { |
|
116 | + if (!is_callable($this->accessLogic)) { |
|
117 | 117 | if ($this->hasModel()) { |
118 | - return function () { |
|
118 | + return function() { |
|
119 | 119 | return $this->getModelConfiguration()->isDisplayable(); |
120 | 120 | }; |
121 | 121 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | { |
134 | 134 | $data = $this->toArray(); |
135 | 135 | |
136 | - if (! is_null($view)) { |
|
136 | + if (!is_null($view)) { |
|
137 | 137 | return view($view, $data)->render(); |
138 | 138 | } |
139 | 139 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function registerModelBindings(Collection $aliases) |
61 | 61 | { |
62 | - $this->router->bind('adminModel', function ($model, Route $route) use ($aliases) { |
|
62 | + $this->router->bind('adminModel', function($model, Route $route) use ($aliases) { |
|
63 | 63 | if (is_null($model = $aliases->get($model))) { |
64 | 64 | throw new ModelNotFoundException(); |
65 | 65 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function runCustomController(Route $route, $controller, $action) |
87 | 87 | { |
88 | - $route->uses(function () use ($route, $controller, $action) { |
|
88 | + $route->uses(function() use ($route, $controller, $action) { |
|
89 | 89 | return (new ControllerDispatcher($this->app))->dispatch( |
90 | 90 | $route, $this->app->make($controller), $action |
91 | 91 | ); |