@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Get instance move up url. |
87 | - * @return Route |
|
87 | + * @return string |
|
88 | 88 | */ |
89 | 89 | protected function moveUpUrl() |
90 | 90 | { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Get instance move down url. |
108 | - * @return Route |
|
108 | + * @return string |
|
109 | 109 | */ |
110 | 110 | protected function moveDownUrl() |
111 | 111 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | Route::post('{adminModel}/{adminModelId}/up', [ |
19 | 19 | 'as' => 'admin.model.move-up', |
20 | - function ($model, $id) { |
|
20 | + function($model, $id) { |
|
21 | 21 | $instance = $model->getRepository()->find($id); |
22 | 22 | $instance->moveUp(); |
23 | 23 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | Route::post('{adminModel}/{adminModelId}/down', [ |
29 | 29 | 'as' => 'admin.model.move-down', |
30 | - function ($model, $id) { |
|
30 | + function($model, $id) { |
|
31 | 31 | $instance = $model->getRepository()->find($id); |
32 | 32 | $instance->moveDown(); |
33 | 33 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getModel() |
50 | 50 | { |
51 | - if (! in_array(OrderableModel::class, trait_uses_recursive($class = get_class($this->model)))) { |
|
51 | + if (!in_array(OrderableModel::class, trait_uses_recursive($class = get_class($this->model)))) { |
|
52 | 52 | throw new \Exception("Model [$class] should uses trait [SleepingOwl\\Admin\\Traits\\OrderableModel]"); |
53 | 53 | } |
54 | 54 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | - * @param mixed $distinct |
|
125 | + * @param string|null $distinct |
|
126 | 126 | * |
127 | 127 | * @return $this |
128 | 128 | */ |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * Apply offset and limit to the query. |
167 | 167 | * |
168 | - * @param $query |
|
168 | + * @param Builder $query |
|
169 | 169 | */ |
170 | 170 | protected function applyOffset($query) |
171 | 171 | { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | /** |
183 | 183 | * Apply orders to the query. |
184 | 184 | * |
185 | - * @param $query |
|
185 | + * @param Builder $query |
|
186 | 186 | */ |
187 | 187 | protected function applyOrders($query) |
188 | 188 | { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * Convert collection to the datatables structure. |
249 | 249 | * |
250 | - * @param array|Collection $collection |
|
250 | + * @param Collection $collection |
|
251 | 251 | * @param int $totalCount |
252 | 252 | * @param int $filteredCount |
253 | 253 | * |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Routing\Router; |
6 | 6 | use Request; |
7 | -use Route; |
|
8 | 7 | use Illuminate\Support\Collection; |
9 | 8 | use Illuminate\Database\Eloquent\Builder; |
10 | 9 | use SleepingOwl\Admin\Contracts\ModelConfigurationInterface; |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public static function registerRoutes(Router $router) |
25 | 25 | { |
26 | - $router->get('{adminModel}/async/{adminDisplayName?}', ['as' => 'admin.model.async', |
|
27 | - function (ModelConfigurationInterface $model, $name = null) { |
|
26 | + $router->get('{adminModel}/async/{adminDisplayName?}', [ 'as' => 'admin.model.async', |
|
27 | + function(ModelConfigurationInterface $model, $name = null) { |
|
28 | 28 | $display = $model->fireDisplay(); |
29 | 29 | if ($display instanceof DisplayTabbed) { |
30 | 30 | $display = static::findDatatablesAsyncByName($display, $name); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $totalCount = $query->count(); |
158 | 158 | $filteredCount = 0; |
159 | 159 | |
160 | - if (! is_null($this->distinct)) { |
|
160 | + if (!is_null($this->distinct)) { |
|
161 | 161 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
162 | 162 | } |
163 | 163 | |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | */ |
201 | 201 | protected function applyOrders($query) |
202 | 202 | { |
203 | - $orders = Request::input('order', []); |
|
203 | + $orders = Request::input('order', [ ]); |
|
204 | 204 | |
205 | 205 | foreach ($orders as $order) { |
206 | - $columnIndex = $order['column']; |
|
207 | - $orderDirection = $order['dir']; |
|
206 | + $columnIndex = $order[ 'column' ]; |
|
207 | + $orderDirection = $order[ 'dir' ]; |
|
208 | 208 | $column = $this->getColumns()->all()->get($columnIndex); |
209 | 209 | |
210 | 210 | if ($column instanceof NamedColumn && $column->isOrderable()) { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | return; |
227 | 227 | } |
228 | 228 | |
229 | - $query->where(function ($query) use ($search) { |
|
229 | + $query->where(function($query) use ($search) { |
|
230 | 230 | $columns = $this->getColumns()->all(); |
231 | 231 | foreach ($columns as $column) { |
232 | 232 | if (in_array(get_class($column), $this->searchableColumns)) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | protected function applyColumnSearch(Builder $query) |
246 | 246 | { |
247 | - $queryColumns = Request::input('columns', []); |
|
247 | + $queryColumns = Request::input('columns', [ ]); |
|
248 | 248 | |
249 | 249 | foreach ($queryColumns as $index => $queryColumn) { |
250 | 250 | $search = array_get($queryColumn, 'search.value'); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $column = $this->getColumns()->all()->get($index); |
253 | 253 | $columnFilter = array_get($this->getColumnFilters()->all(), $index); |
254 | 254 | |
255 | - if (! is_null($columnFilter) && ! is_null($column)) { |
|
255 | + if (!is_null($columnFilter) && !is_null($column)) { |
|
256 | 256 | $columnFilter->apply($this->repository, $column, $query, $search, $fullSearch); |
257 | 257 | } |
258 | 258 | } |
@@ -271,21 +271,21 @@ discard block |
||
271 | 271 | { |
272 | 272 | $columns = $this->getColumns(); |
273 | 273 | |
274 | - $result = []; |
|
275 | - $result['draw'] = Request::input('draw', 0); |
|
276 | - $result['recordsTotal'] = $totalCount; |
|
277 | - $result['recordsFiltered'] = $filteredCount; |
|
278 | - $result['data'] = []; |
|
274 | + $result = [ ]; |
|
275 | + $result[ 'draw' ] = Request::input('draw', 0); |
|
276 | + $result[ 'recordsTotal' ] = $totalCount; |
|
277 | + $result[ 'recordsFiltered' ] = $filteredCount; |
|
278 | + $result[ 'data' ] = [ ]; |
|
279 | 279 | |
280 | 280 | foreach ($collection as $instance) { |
281 | - $_row = []; |
|
281 | + $_row = [ ]; |
|
282 | 282 | |
283 | 283 | foreach ($columns->all() as $column) { |
284 | 284 | $column->setModel($instance); |
285 | - $_row[] = (string) $column; |
|
285 | + $_row[ ] = (string) $column; |
|
286 | 286 | } |
287 | 287 | |
288 | - $result['data'][] = $_row; |
|
288 | + $result[ 'data' ][ ] = $_row; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $result; |
@@ -48,7 +48,7 @@ |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * @return Collection|\SleepingOwl\Admin\Contracts\ActionInterface[] |
|
51 | + * @return ColumnFilterInterface[] |
|
52 | 52 | */ |
53 | 53 | public function all() |
54 | 54 | { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var ColumnFilterInterface[] |
17 | 17 | */ |
18 | - protected $columnFilters = []; |
|
18 | + protected $columnFilters = [ ]; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var string|\Illuminate\View\View |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function set($columnFilters) |
36 | 36 | { |
37 | - if (! is_array($columnFilters)) { |
|
37 | + if (!is_array($columnFilters)) { |
|
38 | 38 | $columnFilters = func_get_args(); |
39 | 39 | } |
40 | 40 | |
41 | - $this->columnFilters = []; |
|
41 | + $this->columnFilters = [ ]; |
|
42 | 42 | |
43 | 43 | foreach ($columnFilters as $filter) { |
44 | 44 | $this->push($filter); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function push(ColumnFilterInterface $filter = null) |
64 | 64 | { |
65 | - $this->columnFilters[] = $filter; |
|
65 | + $this->columnFilters[ ] = $filter; |
|
66 | 66 | |
67 | 67 | return $this; |
68 | 68 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | - if (! $this->hasHtmlAttribute('class')) { |
|
158 | + if (!$this->hasHtmlAttribute('class')) { |
|
159 | 159 | $this->setHtmlAttribute('class', 'panel-footer'); |
160 | 160 | } |
161 | 161 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | /** |
23 | 23 | * @param array|string $scopes |
24 | 24 | * |
25 | - * @return $this |
|
25 | + * @return \SleepingOwl\Admin\Contracts\DisplayInterface |
|
26 | 26 | */ |
27 | 27 | public function set($scopes) |
28 | 28 | { |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * @var string[] |
11 | 11 | */ |
12 | - protected $scopes = []; |
|
12 | + protected $scopes = [ ]; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @return string[] |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function push($scope) |
40 | 40 | { |
41 | - if (! is_array($scope)) { |
|
41 | + if (!is_array($scope)) { |
|
42 | 42 | $scope = func_get_args(); |
43 | 43 | } |
44 | 44 | |
45 | - $this->scopes[] = $scope; |
|
45 | + $this->scopes[ ] = $scope; |
|
46 | 46 | |
47 | 47 | return $this; |
48 | 48 | } |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | public function modifyQuery(Builder $query) |
66 | 66 | { |
67 | 67 | foreach ($this->scopes as $scope) { |
68 | - if (! is_null($scope)) { |
|
68 | + if (!is_null($scope)) { |
|
69 | 69 | if (is_array($scope)) { |
70 | 70 | $method = array_shift($scope); |
71 | 71 | $params = $scope; |
72 | 72 | } else { |
73 | 73 | $method = $scope; |
74 | - $params = []; |
|
74 | + $params = [ ]; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | call_user_func_array([ |
@@ -48,7 +48,7 @@ |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * @return string |
|
51 | + * @return integer |
|
52 | 52 | */ |
53 | 53 | public function getSize() |
54 | 54 | { |
@@ -207,7 +207,7 @@ |
||
207 | 207 | * @deprecated 4.5.0 |
208 | 208 | * @see getElements() |
209 | 209 | * |
210 | - * @return Collection[] |
|
210 | + * @return Collection |
|
211 | 211 | */ |
212 | 212 | public function getItems() |
213 | 213 | { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @param array $elements |
75 | 75 | */ |
76 | - public function __construct(array $elements = []) |
|
76 | + public function __construct(array $elements = [ ]) |
|
77 | 77 | { |
78 | 78 | parent::__construct($elements); |
79 | 79 | |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $this->initialized = true; |
97 | - $this->repository = app(RepositoryInterface::class, [$this->class]); |
|
97 | + $this->repository = app(RepositoryInterface::class, [ $this->class ]); |
|
98 | 98 | |
99 | 99 | $this->setModel(app($this->class)); |
100 | 100 | |
101 | 101 | parent::initialize(); |
102 | 102 | |
103 | - $this->getElements()->each(function ($element) { |
|
104 | - if ($element instanceof Upload and ! $this->hasHtmlAttribute('enctype')) { |
|
103 | + $this->getElements()->each(function($element) { |
|
104 | + if ($element instanceof Upload and !$this->hasHtmlAttribute('enctype')) { |
|
105 | 105 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
106 | 106 | } |
107 | 107 | }); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function setItems($items) |
232 | 232 | { |
233 | - if (! is_array($items)) { |
|
233 | + if (!is_array($items)) { |
|
234 | 234 | $items = func_get_args(); |
235 | 235 | } |
236 | 236 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function setId($id) |
259 | 259 | { |
260 | - if (is_null($this->id) and ! is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
260 | + if (is_null($this->id) and !is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
261 | 261 | $this->id = $id; |
262 | 262 | $this->setModel($model); |
263 | 263 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $model = $this->getModel(); |
324 | 324 | |
325 | 325 | foreach ($model->getRelations() as $name => $relation) { |
326 | - if ($model->{$name}() instanceof BelongsTo && ! is_null($relation)) { |
|
326 | + if ($model->{$name}() instanceof BelongsTo && !is_null($relation)) { |
|
327 | 327 | $relation->save(); |
328 | 328 | $model->{$name}()->associate($relation); |
329 | 329 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $model = $this->getModel(); |
336 | 336 | |
337 | 337 | foreach ($model->getRelations() as $name => $relation) { |
338 | - if ($model->{$name}() instanceof HasOneOrMany && ! is_null($relation)) { |
|
338 | + if ($model->{$name}() instanceof HasOneOrMany && !is_null($relation)) { |
|
339 | 339 | if (is_array($relation) || $relation instanceof \Traversable) { |
340 | 340 | $model->{$name}()->saveMany($relation); |
341 | 341 | } else { |
@@ -46,7 +46,7 @@ |
||
46 | 46 | /** |
47 | 47 | * Move model in the $destination. |
48 | 48 | * |
49 | - * @param $destination -1 (move down) or 1 (move up) |
|
49 | + * @param integer $destination -1 (move down) or 1 (move up) |
|
50 | 50 | */ |
51 | 51 | protected function move($destination) |
52 | 52 | { |
@@ -73,8 +73,8 @@ |
||
73 | 73 | protected function updateOrderFieldOnDelete() |
74 | 74 | { |
75 | 75 | static::orderModel() |
76 | - ->where($this->getOrderField(), '>', $this->getOrderValue()) |
|
77 | - ->decrement($this->getOrderField()); |
|
76 | + ->where($this->getOrderField(), '>', $this->getOrderValue()) |
|
77 | + ->decrement($this->getOrderField()); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -9,11 +9,11 @@ |
||
9 | 9 | */ |
10 | 10 | protected static function bootOrderableModel() |
11 | 11 | { |
12 | - static::creating(function ($row) { |
|
12 | + static::creating(function($row) { |
|
13 | 13 | $row->updateOrderFieldOnCreate(); |
14 | 14 | }); |
15 | 15 | |
16 | - static::deleted(function ($row) { |
|
16 | + static::deleted(function($row) { |
|
17 | 17 | $row->updateOrderFieldOnDelete(); |
18 | 18 | }); |
19 | 19 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | /** |
81 | 81 | * @param string $editorId |
82 | 82 | * |
83 | - * @return bool |
|
83 | + * @return boolean|null |
|
84 | 84 | */ |
85 | 85 | public function loadEditor($editorId) |
86 | 86 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function register($editorId, WysiwygFilterInterface $filter = null, $name = null) |
45 | 45 | { |
46 | - $config = config('sleeping_owl.wysiwyg.'.$editorId, []); |
|
46 | + $config = config('sleeping_owl.wysiwyg.'.$editorId, [ ]); |
|
47 | 47 | |
48 | 48 | $this->getFilters()->push( |
49 | 49 | $editor = new Editor($editorId, $name, $filter, $config) |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getEditor($editorId) |
69 | 69 | { |
70 | - return $this->getFilters()->filter(function (WysiwygEditorInterface $editor) use ($editorId) { |
|
70 | + return $this->getFilters()->filter(function(WysiwygEditorInterface $editor) use ($editorId) { |
|
71 | 71 | return $editor->getId() == $editorId; |
72 | 72 | })->first(); |
73 | 73 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function loadEditor($editorId) |
86 | 86 | { |
87 | - if (! is_null($editor = $this->getEditor($editorId))) { |
|
87 | + if (!is_null($editor = $this->getEditor($editorId))) { |
|
88 | 88 | if ($editor->isUsed()) { |
89 | 89 | return true; |
90 | 90 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function applyFilter($editorId, $text) |
106 | 106 | { |
107 | - if (! is_null($editor = $this->getEditor($editorId))) { |
|
107 | + if (!is_null($editor = $this->getEditor($editorId))) { |
|
108 | 108 | return $editor->applyFilter($text); |
109 | 109 | } |
110 | 110 |
@@ -87,6 +87,6 @@ |
||
87 | 87 | | |
88 | 88 | */ |
89 | 89 | |
90 | - 'attributes' => [], |
|
90 | + 'attributes' => [ ], |
|
91 | 91 | |
92 | 92 | ]; |