@@ -308,7 +308,7 @@ |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | - * @return \Illuminate\Foundation\Application|mixed |
|
311 | + * @return RepositoryInterface |
|
312 | 312 | * @throws \Exception |
313 | 313 | */ |
314 | 314 | protected function makeRepository() |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @var array |
52 | 52 | */ |
53 | - protected $with = []; |
|
53 | + protected $with = [ ]; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @var string |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->repository = $this->makeRepository(); |
168 | 168 | $this->repository->with($this->with); |
169 | 169 | |
170 | - $this->extensions->each(function (DisplayExtensionInterface $extension) { |
|
170 | + $this->extensions->each(function(DisplayExtensionInterface $extension) { |
|
171 | 171 | if ($extension instanceof Initializable) { |
172 | 172 | $extension->initialize(); |
173 | 173 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | $this->title, |
202 | 202 | ]; |
203 | 203 | |
204 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
204 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
205 | 205 | if (method_exists($extension, $method = 'getTitle')) { |
206 | - $titles[] = call_user_func([$extension, $method]); |
|
206 | + $titles[ ] = call_user_func([ $extension, $method ]); |
|
207 | 207 | } |
208 | 208 | }); |
209 | 209 | |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | { |
266 | 266 | $view = app('sleeping_owl.template')->view($this->getView(), $this->toArray()); |
267 | 267 | |
268 | - $blocks = []; |
|
268 | + $blocks = [ ]; |
|
269 | 269 | |
270 | - $placableExtensions = $this->getExtensions()->filter(function ($extension) { |
|
270 | + $placableExtensions = $this->getExtensions()->filter(function($extension) { |
|
271 | 271 | return $extension instanceof Placable; |
272 | 272 | }); |
273 | 273 | |
274 | 274 | foreach ($placableExtensions as $extension) { |
275 | - $blocks[$extension->getPlacement()][] = (string) app('sleeping_owl.template')->view( |
|
275 | + $blocks[ $extension->getPlacement() ][ ] = (string) app('sleeping_owl.template')->view( |
|
276 | 276 | $extension->getView(), |
277 | 277 | $extension->toArray() |
278 | 278 | ); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | foreach ($blocks as $block => $data) { |
282 | 282 | foreach ($data as $html) { |
283 | - if (! empty($html)) { |
|
283 | + if (!empty($html)) { |
|
284 | 284 | $view->getFactory()->startSection($block); |
285 | 285 | echo $html; |
286 | 286 | $view->getFactory()->yieldSection(); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $extension = $this->extensions->get($method); |
316 | 316 | |
317 | 317 | if (method_exists($extension, 'set')) { |
318 | - return call_user_func_array([$extension, 'set'], $arguments); |
|
318 | + return call_user_func_array([ $extension, 'set' ], $arguments); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | */ |
337 | 337 | protected function makeRepository() |
338 | 338 | { |
339 | - $repository = app($this->repositoryClass, [$this->modelClass]); |
|
339 | + $repository = app($this->repositoryClass, [ $this->modelClass ]); |
|
340 | 340 | |
341 | - if (! ($repository instanceof RepositoryInterface)) { |
|
341 | + if (!($repository instanceof RepositoryInterface)) { |
|
342 | 342 | throw new \Exception('Repository class must be instanced of [RepositoryInterface]'); |
343 | 343 | } |
344 | 344 |
@@ -145,7 +145,7 @@ |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | - * @param string|\Illuminate\View\View $view |
|
148 | + * @param string $view |
|
149 | 149 | * |
150 | 150 | * @return $this |
151 | 151 | */ |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | $this->controlActive = false; |
89 | 89 | |
90 | 90 | if ($this->isInitialize()) { |
91 | - $this->columns = $this->columns->filter(function ($column) { |
|
91 | + $this->columns = $this->columns->filter(function($column) { |
|
92 | 92 | $class = get_class($this->getControlColumn()); |
93 | 93 | |
94 | - return ! ($column instanceof $class); |
|
94 | + return !($column instanceof $class); |
|
95 | 95 | }); |
96 | 96 | } |
97 | 97 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function set($columns) |
115 | 115 | { |
116 | - if (! is_array($columns)) { |
|
116 | + if (!is_array($columns)) { |
|
117 | 117 | $columns = func_get_args(); |
118 | 118 | } |
119 | 119 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | public function initialize() |
181 | 181 | { |
182 | - $this->all()->each(function (ColumnInterface $column) { |
|
182 | + $this->all()->each(function(ColumnInterface $column) { |
|
183 | 183 | $column->initialize(); |
184 | 184 | }); |
185 | 185 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | public function render() |
199 | 199 | { |
200 | 200 | $params = $this->toArray(); |
201 | - $params['collection'] = $this->getDisplay()->getCollection(); |
|
202 | - $params['pagination'] = null; |
|
201 | + $params[ 'collection' ] = $this->getDisplay()->getCollection(); |
|
202 | + $params[ 'pagination' ] = null; |
|
203 | 203 | |
204 | - if ($params['collection'] instanceof \Illuminate\Contracts\Pagination\Paginator) { |
|
204 | + if ($params[ 'collection' ] instanceof \Illuminate\Contracts\Pagination\Paginator) { |
|
205 | 205 | if (class_exists('Illuminate\Pagination\BootstrapThreePresenter')) { |
206 | - $params['pagination'] = (new \Illuminate\Pagination\BootstrapThreePresenter($params['collection']))->render(); |
|
206 | + $params[ 'pagination' ] = (new \Illuminate\Pagination\BootstrapThreePresenter($params[ 'collection' ]))->render(); |
|
207 | 207 | } else { |
208 | - $params['pagination'] = $params['collection']->render(); |
|
208 | + $params[ 'pagination' ] = $params[ 'collection' ]->render(); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * @return Closure |
|
86 | + * @return \Closure |
|
87 | 87 | */ |
88 | 88 | public function getAccessLogic() |
89 | 89 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getModelConfiguration() |
33 | 33 | { |
34 | - if (! $this->hasModel()) { |
|
34 | + if (!$this->hasModel()) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function hasModel() |
45 | 45 | { |
46 | - return ! is_null($this->model) and class_exists($this->model); |
|
46 | + return !is_null($this->model) and class_exists($this->model); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function getAccessLogic() |
89 | 89 | { |
90 | - if (! is_callable($this->accessLogic)) { |
|
90 | + if (!is_callable($this->accessLogic)) { |
|
91 | 91 | if ($this->hasModel()) { |
92 | - return function () { |
|
92 | + return function() { |
|
93 | 93 | return $this->getModelConfiguration()->isDisplayable(); |
94 | 94 | }; |
95 | 95 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $data = $this->toArray(); |
109 | 109 | |
110 | - if (! is_null($view)) { |
|
110 | + if (!is_null($view)) { |
|
111 | 111 | return view($view, $data)->render(); |
112 | 112 | } |
113 | 113 |
@@ -214,7 +214,7 @@ |
||
214 | 214 | /** |
215 | 215 | * @param $object |
216 | 216 | * |
217 | - * @return mixed |
|
217 | + * @return Model |
|
218 | 218 | */ |
219 | 219 | protected function getElementContainer($object) |
220 | 220 | { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function initializeElements() |
21 | 21 | { |
22 | - $this->getElements()->each(function ($element) { |
|
22 | + $this->getElements()->each(function($element) { |
|
23 | 23 | if ($element instanceof Initializable) { |
24 | 24 | $element->initialize(); |
25 | 25 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | foreach ($this->getElements() as $element) { |
39 | 39 | if ($element instanceof ElementsInterface) { |
40 | - if (! is_null($found = $element->getElement($path))) { |
|
40 | + if (!is_null($found = $element->getElement($path))) { |
|
41 | 41 | return $found; |
42 | 42 | } |
43 | 43 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | protected function setModelForElements(Model $model) |
133 | 133 | { |
134 | - $this->getElements()->each(function ($element) use ($model) { |
|
134 | + $this->getElements()->each(function($element) use ($model) { |
|
135 | 135 | $element = $this->getElementContainer($element); |
136 | 136 | |
137 | 137 | if ($element instanceof FormElementInterface) { |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return array |
153 | 153 | */ |
154 | - protected function getValidationRulesFromElements(array $rules = []) |
|
154 | + protected function getValidationRulesFromElements(array $rules = [ ]) |
|
155 | 155 | { |
156 | - $this->getElements()->onlyActive()->each(function ($element) use (&$rules) { |
|
156 | + $this->getElements()->onlyActive()->each(function($element) use (&$rules) { |
|
157 | 157 | $element = $this->getElementContainer($element); |
158 | 158 | |
159 | 159 | if ($element instanceof FormElementInterface) { |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return array |
171 | 171 | */ |
172 | - protected function getValidationMessagesForElements(array $messages = []) |
|
172 | + protected function getValidationMessagesForElements(array $messages = [ ]) |
|
173 | 173 | { |
174 | - $this->getElements()->onlyActive()->each(function ($element) use (&$messages) { |
|
174 | + $this->getElements()->onlyActive()->each(function($element) use (&$messages) { |
|
175 | 175 | $element = $this->getElementContainer($element); |
176 | 176 | |
177 | 177 | if ($element instanceof FormElementInterface) { |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return array |
189 | 189 | */ |
190 | - protected function getValidationLabelsForElements(array $labels = []) |
|
190 | + protected function getValidationLabelsForElements(array $labels = [ ]) |
|
191 | 191 | { |
192 | - $this->getElements()->onlyActive()->each(function ($element) use (&$labels) { |
|
192 | + $this->getElements()->onlyActive()->each(function($element) use (&$labels) { |
|
193 | 193 | $element = $this->getElementContainer($element); |
194 | 194 | |
195 | 195 | if ($element instanceof NamedFormElement) { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | protected function saveElements() |
204 | 204 | { |
205 | - $this->getElements()->onlyActive()->each(function ($element) { |
|
205 | + $this->getElements()->onlyActive()->each(function($element) { |
|
206 | 206 | $element = $this->getElementContainer($element); |
207 | 207 | |
208 | 208 | if ($element instanceof FormElementInterface) { |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | protected function afterSaveElements() |
215 | 215 | { |
216 | - $this->getElements()->onlyActive()->each(function ($element) { |
|
216 | + $this->getElements()->onlyActive()->each(function($element) { |
|
217 | 217 | $element = $this->getElementContainer($element); |
218 | 218 | |
219 | 219 | if ($element instanceof FormElementInterface) { |
@@ -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 | } |
@@ -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 { |
@@ -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 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | - * @return TabInterface[]|DisplayTabsCollection |
|
68 | + * @return \SleepingOwl\Admin\Form\FormElementsCollection |
|
69 | 69 | */ |
70 | 70 | public function getTabs() |
71 | 71 | { |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | */ |
18 | 18 | protected static function validate(Validator $validator) |
19 | 19 | { |
20 | - $validator->after(function ($validator) { |
|
20 | + $validator->after(function($validator) { |
|
21 | 21 | /** @var \Illuminate\Http\UploadedFile $file */ |
22 | 22 | $file = array_get($validator->attributes(), 'file'); |
23 | 23 | |
24 | 24 | $size = getimagesize($file->getRealPath()); |
25 | 25 | |
26 | - if (! $size) { |
|
26 | + if (!$size) { |
|
27 | 27 | $validator->errors()->add('file', trans('sleeping_owl::validation.not_image')); |
28 | 28 | } |
29 | 29 | }); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $image = \Intervention\Image\Facades\Image::make($file); |
46 | 46 | |
47 | 47 | foreach ($settings as $method => $args) { |
48 | - call_user_func_array([$image, $method], $args); |
|
48 | + call_user_func_array([ $image, $method ], $args); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $image->save($path.'/'.$filename); |
@@ -77,5 +77,5 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @var array |
79 | 79 | */ |
80 | - protected $uploadValidationRules = ['required', 'image']; |
|
80 | + protected $uploadValidationRules = [ 'required', 'image' ]; |
|
81 | 81 | } |