@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @param array $replace |
169 | 169 | * @param string $locale |
170 | 170 | * |
171 | - * @return \Illuminate\Contracts\Translation\Translator|string|array|null |
|
171 | + * @return string|null |
|
172 | 172 | */ |
173 | 173 | function admin_trans($key = null, $replace = [], $locale = null) |
174 | 174 | { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * Delete from array by value. |
189 | 189 | * |
190 | 190 | * @param array $array |
191 | - * @param mixed $value |
|
191 | + * @param string $value |
|
192 | 192 | */ |
193 | 193 | function array_delete(&$array, $value) |
194 | 194 | { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function admin_path($path = '') |
15 | 15 | { |
16 | - return ucfirst(config('admin.directory')) . ($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
16 | + return ucfirst(config('admin.directory')).($path ? DIRECTORY_SEPARATOR . $path : $path); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function admin_base_path($path = '', $basePathFlag = true) |
52 | 52 | { |
53 | - $prefix = '/' . trim(config('admin.route.prefix'), '/'); |
|
53 | + $prefix = '/'.trim(config('admin.route.prefix'), '/'); |
|
54 | 54 | $prefix = ($prefix == '/') ? '' : $prefix; |
55 | 55 | |
56 | - $path = '/' . trim($path, '/'); |
|
56 | + $path = '/'.trim($path, '/'); |
|
57 | 57 | $path = ($path == '/') ? '' : $path; |
58 | 58 | |
59 | - $basePath = '/' . trim(config('admin.base_path'), '/'); |
|
59 | + $basePath = '/'.trim(config('admin.base_path'), '/'); |
|
60 | 60 | $basePath = ($basePath == '/') ? '' : $basePath; |
61 | 61 | |
62 | - $requestPath = ($basePathFlag !== false ? $basePath : '') . $prefix . $path; |
|
62 | + $requestPath = ($basePathFlag !== false ? $basePath : '').$prefix.$path; |
|
63 | 63 | |
64 | 64 | return ($requestPath == '/') ? '' : $requestPath; |
65 | 65 | } |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | */ |
151 | 151 | function admin_asset($path) |
152 | 152 | { |
153 | - $basePath = '/' . trim(config('admin.base_path'), '/'); |
|
153 | + $basePath = '/'.trim(config('admin.base_path'), '/'); |
|
154 | 154 | $basePath = ($basePath == '/') ? '' : $basePath; |
155 | 155 | |
156 | - $path = $basePath . '/'. trim($path, '/'); |
|
156 | + $path = $basePath.'/'.trim($path, '/'); |
|
157 | 157 | |
158 | 158 | return (config('admin.https') || config('admin.secure')) ? secure_asset($path) : asset($path); |
159 | 159 | } |
@@ -261,15 +261,15 @@ discard block |
||
261 | 261 | function file_size($bytes) |
262 | 262 | { |
263 | 263 | if ($bytes >= 1073741824) { |
264 | - $bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
|
264 | + $bytes = number_format($bytes / 1073741824, 2).' GB'; |
|
265 | 265 | } elseif ($bytes >= 1048576) { |
266 | - $bytes = number_format($bytes / 1048576, 2) . ' MB'; |
|
266 | + $bytes = number_format($bytes / 1048576, 2).' MB'; |
|
267 | 267 | } elseif ($bytes >= 1024) { |
268 | - $bytes = number_format($bytes / 1024, 2) . ' KB'; |
|
268 | + $bytes = number_format($bytes / 1024, 2).' KB'; |
|
269 | 269 | } elseif ($bytes > 1) { |
270 | - $bytes = $bytes . ' bytes'; |
|
270 | + $bytes = $bytes.' bytes'; |
|
271 | 271 | } elseif ($bytes == 1) { |
272 | - $bytes = $bytes . ' byte'; |
|
272 | + $bytes = $bytes.' byte'; |
|
273 | 273 | } else { |
274 | 274 | $bytes = '0 bytes'; |
275 | 275 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $column = new Column($column, $label); |
364 | 364 | $column->setGrid($this); |
365 | 365 | |
366 | - return tap($column, function ($value) { |
|
366 | + return tap($column, function($value) { |
|
367 | 367 | $this->columns->push($value); |
368 | 368 | }); |
369 | 369 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $column = new Column($column, $label); |
428 | 428 | $column->setGrid($this); |
429 | 429 | |
430 | - return tap($column, function ($value) { |
|
430 | + return tap($column, function($value) { |
|
431 | 431 | $this->columns->prepend($value); |
432 | 432 | }); |
433 | 433 | } |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | |
608 | 608 | $data = $collection->toArray(); |
609 | 609 | |
610 | - $this->columns->map(function (Column $column) use (&$data) { |
|
610 | + $this->columns->map(function(Column $column) use (&$data) { |
|
611 | 611 | $data = $column->fill($data); |
612 | 612 | |
613 | 613 | $this->columnNames[] = $column->getName(); |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | */ |
628 | 628 | protected function buildRows(array $data) |
629 | 629 | { |
630 | - $this->rows = collect($data)->map(function ($model, $number) { |
|
630 | + $this->rows = collect($data)->map(function($model, $number) { |
|
631 | 631 | return new Row($number, $model); |
632 | 632 | }); |
633 | 633 | |
@@ -795,10 +795,10 @@ discard block |
||
795 | 795 | return $this->resourcePath; |
796 | 796 | } |
797 | 797 | |
798 | - $basePath = '/' . trim(config('admin.base_path'), '/') ; |
|
798 | + $basePath = '/'.trim(config('admin.base_path'), '/'); |
|
799 | 799 | $basePath = ($basePath == '/') ? '' : $basePath; |
800 | 800 | |
801 | - return $basePath . app('request')->getPathInfo(); |
|
801 | + return $basePath.app('request')->getPathInfo(); |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | /** |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | protected function removeFilterByID($id) |
286 | 286 | { |
287 | - $this->filters = array_filter($this->filters, function (AbstractFilter $filter) use ($id) { |
|
287 | + $this->filters = array_filter($this->filters, function(AbstractFilter $filter) use ($id) { |
|
288 | 288 | return $filter->getId() != $id; |
289 | 289 | }); |
290 | 290 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | { |
299 | 299 | $inputs = Arr::dot(Input::all()); |
300 | 300 | |
301 | - $inputs = array_filter($inputs, function ($input) { |
|
301 | + $inputs = array_filter($inputs, function($input) { |
|
302 | 302 | return $input !== '' && !is_null($input); |
303 | 303 | }); |
304 | 304 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | - return tap(array_filter($conditions), function ($conditions) { |
|
329 | + return tap(array_filter($conditions), function($conditions) { |
|
330 | 330 | if (!empty($conditions)) { |
331 | 331 | $this->expand(); |
332 | 332 | } |
@@ -344,9 +344,9 @@ discard block |
||
344 | 344 | return $inputs; |
345 | 345 | } |
346 | 346 | |
347 | - $inputs = collect($inputs)->filter(function ($input, $key) { |
|
347 | + $inputs = collect($inputs)->filter(function($input, $key) { |
|
348 | 348 | return Str::startsWith($key, "{$this->name}_"); |
349 | - })->mapWithKeys(function ($val, $key) { |
|
349 | + })->mapWithKeys(function($val, $key) { |
|
350 | 350 | $key = str_replace("{$this->name}_", '', $key); |
351 | 351 | |
352 | 352 | return [$key => $val]; |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function scope($key, $label = '') |
418 | 418 | { |
419 | - return tap(new Scope($key, $label), function (Scope $scope) { |
|
419 | + return tap(new Scope($key, $label), function(Scope $scope) { |
|
420 | 420 | return $this->scopes->push($scope); |
421 | 421 | }); |
422 | 422 | } |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | { |
441 | 441 | $key = request(Scope::QUERY_NAME); |
442 | 442 | |
443 | - return $this->scopes->first(function ($scope) use ($key) { |
|
443 | + return $this->scopes->first(function($scope) use ($key) { |
|
444 | 444 | return $scope->key == $key; |
445 | 445 | }); |
446 | 446 | } |
@@ -565,9 +565,9 @@ discard block |
||
565 | 565 | |
566 | 566 | $columns->push($pageKey); |
567 | 567 | |
568 | - $groupNames = collect($this->filters)->filter(function ($filter) { |
|
568 | + $groupNames = collect($this->filters)->filter(function($filter) { |
|
569 | 569 | return $filter instanceof Group; |
570 | - })->map(function (AbstractFilter $filter) { |
|
570 | + })->map(function(AbstractFilter $filter) { |
|
571 | 571 | return "{$filter->getId()}_group"; |
572 | 572 | }); |
573 | 573 | |
@@ -608,10 +608,10 @@ discard block |
||
608 | 608 | |
609 | 609 | $question = $request->getBaseUrl().$request->getPathInfo() == '/' ? '/?' : '?'; |
610 | 610 | |
611 | - $basePath = '/' . trim(config('admin.base_path'), '/'); |
|
611 | + $basePath = '/'.trim(config('admin.base_path'), '/'); |
|
612 | 612 | $basePath = ($basePath == '/') ? '' : $basePath; |
613 | 613 | |
614 | - return $basePath . (count($request->query()) > 0 |
|
614 | + return $basePath.(count($request->query()) > 0 |
|
615 | 615 | ? $request->getPathInfo().$question.http_build_query($query) |
616 | 616 | : $request->getPathInfo()); |
617 | 617 | } |
@@ -41,9 +41,9 @@ |
||
41 | 41 | ]); |
42 | 42 | |
43 | 43 | return collect($excepts) |
44 | - ->map(function ($expect) { |
|
44 | + ->map(function($expect) { |
|
45 | 45 | return admin_base_path($expect, false); |
46 | - })->contains(function ($except) use ($request) { |
|
46 | + })->contains(function($except) use ($request) { |
|
47 | 47 | if ($except !== '/') { |
48 | 48 | $except = trim($except, '/'); |
49 | 49 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function respond(Response $response) |
49 | 49 | { |
50 | - $next = function () use ($response) { |
|
50 | + $next = function() use ($response) { |
|
51 | 51 | return $response; |
52 | 52 | }; |
53 | 53 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function decodeUtf8HtmlEntities($html) |
141 | 141 | { |
142 | - return preg_replace_callback('/(&#[0-9]+;)/', function ($html) { |
|
142 | + return preg_replace_callback('/(&#[0-9]+;)/', function($html) { |
|
143 | 143 | return mb_convert_encoding($html[1], 'UTF-8', 'HTML-ENTITIES'); |
144 | 144 | }, $html); |
145 | 145 | } |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function setUriHeader(Response $response, Request $request) |
154 | 154 | { |
155 | - $basePath = '/' . trim(config('admin.base_path'), '/'); |
|
155 | + $basePath = '/'.trim(config('admin.base_path'), '/'); |
|
156 | 156 | $basePath = ($basePath == '/') ? '' : $basePath; |
157 | 157 | |
158 | 158 | $response->header( |
159 | 159 | 'X-PJAX-URL', |
160 | - $basePath . $request->getRequestUri() |
|
160 | + $basePath.$request->getRequestUri() |
|
161 | 161 | ); |
162 | 162 | } |
163 | 163 | } |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | { |
89 | 89 | $this->model = $model; |
90 | 90 | |
91 | - $basePath = '/' . trim(config('admin.base_path'), '/'); |
|
91 | + $basePath = '/'.trim(config('admin.base_path'), '/'); |
|
92 | 92 | $basePath = ($basePath == '/') ? '' : $basePath; |
93 | 93 | |
94 | - $this->path = $basePath . app('request')->getPathInfo(); |
|
94 | + $this->path = $basePath.app('request')->getPathInfo(); |
|
95 | 95 | $this->elementId .= uniqid(); |
96 | 96 | |
97 | 97 | $this->setupTools(); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | protected function initBranchCallback() |
120 | 120 | { |
121 | 121 | if (is_null($this->branchCallback)) { |
122 | - $this->branchCallback = function ($branch) { |
|
122 | + $this->branchCallback = function($branch) { |
|
123 | 123 | $key = $branch[$this->model->getKeyName()]; |
124 | 124 | $title = $branch[$this->model->getTitleColumn()]; |
125 | 125 |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $this->overwriteExistingField($name); |
225 | 225 | |
226 | - return tap($field, function ($field) { |
|
226 | + return tap($field, function($field) { |
|
227 | 227 | $this->fields->push($field); |
228 | 228 | }); |
229 | 229 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | $this->overwriteExistingRelation($name); |
247 | 247 | |
248 | - return tap($relation, function ($relation) { |
|
248 | + return tap($relation, function($relation) { |
|
249 | 249 | $this->relations->push($relation); |
250 | 250 | }); |
251 | 251 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | $this->fields = $this->fields->filter( |
265 | - function (Field $field) use ($name) { |
|
265 | + function(Field $field) use ($name) { |
|
266 | 266 | return $field->getName() != $name; |
267 | 267 | } |
268 | 268 | ); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | $this->relations = $this->relations->filter( |
283 | - function (Relation $relation) use ($name) { |
|
283 | + function(Relation $relation) use ($name) { |
|
284 | 284 | return $relation->getName() != $name; |
285 | 285 | } |
286 | 286 | ); |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | public function getResourcePath() |
317 | 317 | { |
318 | 318 | if (empty($this->resource)) { |
319 | - $basePath = trim(config('admin.base_path'), '/') . '/'; |
|
319 | + $basePath = trim(config('admin.base_path'), '/').'/'; |
|
320 | 320 | $basePath = ($basePath == '/') ? '' : $basePath; |
321 | 321 | |
322 | - $path = $basePath . request()->path(); |
|
322 | + $path = $basePath.request()->path(); |
|
323 | 323 | |
324 | 324 | $segments = explode('/', $path); |
325 | 325 | array_pop($segments); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
342 | 342 | { |
343 | - collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
343 | + collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) { |
|
344 | 344 | $field->each->setWidth($fieldWidth, $labelWidth); |
345 | 345 | }); |
346 | 346 |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | $request->session()->invalidate(); |
83 | 83 | |
84 | - $basePath = trim(config('admin.base_path'), '/') . '/'; |
|
84 | + $basePath = trim(config('admin.base_path'), '/').'/'; |
|
85 | 85 | $basePath = ($basePath == '/') ? '' : $basePath; |
86 | 86 | |
87 | - return redirect($basePath . config('admin.route.prefix')); |
|
87 | + return redirect($basePath.config('admin.route.prefix')); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | $form = $this->settingForm(); |
100 | 100 | $form->tools( |
101 | - function (Form\Tools $tools) { |
|
101 | + function(Form\Tools $tools) { |
|
102 | 102 | $tools->disableList(); |
103 | 103 | } |
104 | 104 | ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $form->image('avatar', trans('admin.avatar')); |
135 | 135 | $form->password('password', trans('admin.password'))->rules('confirmed|required'); |
136 | 136 | $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required') |
137 | - ->default(function ($form) { |
|
137 | + ->default(function($form) { |
|
138 | 138 | return $form->model()->password; |
139 | 139 | }); |
140 | 140 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | |
143 | 143 | $form->ignore(['password_confirmation']); |
144 | 144 | |
145 | - $form->saving(function (Form $form) { |
|
145 | + $form->saving(function(Form $form) { |
|
146 | 146 | if ($form->password && $form->model()->password != $form->password) { |
147 | 147 | $form->password = bcrypt($form->password); |
148 | 148 | } |
149 | 149 | }); |
150 | 150 | |
151 | - $form->saved(function () { |
|
151 | + $form->saved(function() { |
|
152 | 152 | admin_toastr(trans('admin.update_succeeded')); |
153 | 153 | |
154 | 154 | return redirect(admin_base_path('auth/setting')); |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | return $this->redirectTo(); |
179 | 179 | } |
180 | 180 | |
181 | - $basePath = trim(config('admin.base_path'), '/') . '/'; |
|
181 | + $basePath = trim(config('admin.base_path'), '/').'/'; |
|
182 | 182 | $basePath = ($basePath == '/') ? '' : $basePath; |
183 | 183 | |
184 | - return property_exists($this, 'redirectTo') ? $this->redirectTo : ($basePath . config('admin.route.prefix')); |
|
184 | + return property_exists($this, 'redirectTo') ? $this->redirectTo : ($basePath.config('admin.route.prefix')); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | return $ret; |
306 | 306 | } |
307 | 307 | |
308 | - collect(explode(',', $id))->filter()->each(function ($id) { |
|
308 | + collect(explode(',', $id))->filter()->each(function($id) { |
|
309 | 309 | $builder = $this->model()->newQuery(); |
310 | 310 | |
311 | 311 | if ($this->isSoftDeletes) { |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | |
359 | 359 | $data = $model->toArray(); |
360 | 360 | |
361 | - $this->builder->fields()->filter(function ($field) { |
|
361 | + $this->builder->fields()->filter(function($field) { |
|
362 | 362 | return $field instanceof Field\File; |
363 | - })->each(function (Field\File $file) use ($data) { |
|
363 | + })->each(function(Field\File $file) use ($data) { |
|
364 | 364 | $file->setOriginal($data); |
365 | 365 | |
366 | 366 | $file->destroy(); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | return $response; |
386 | 386 | } |
387 | 387 | |
388 | - DB::transaction(function () { |
|
388 | + DB::transaction(function() { |
|
389 | 389 | $inserts = $this->prepareInsert($this->updates); |
390 | 390 | |
391 | 391 | foreach ($inserts as $column => $value) { |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | return $response; |
537 | 537 | } |
538 | 538 | |
539 | - DB::transaction(function () { |
|
539 | + DB::transaction(function() { |
|
540 | 540 | $updates = $this->prepareUpdate($this->updates); |
541 | 541 | |
542 | 542 | foreach ($updates as $column => $value) { |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | protected function getFieldByColumn($column) |
1017 | 1017 | { |
1018 | 1018 | return $this->builder->fields()->first( |
1019 | - function (Field $field) use ($column) { |
|
1019 | + function(Field $field) use ($column) { |
|
1020 | 1020 | if (is_array($field->column())) { |
1021 | 1021 | return in_array($column, $field->column()); |
1022 | 1022 | } |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | |
1038 | 1038 | $values = $this->model->toArray(); |
1039 | 1039 | |
1040 | - $this->builder->fields()->each(function (Field $field) use ($values) { |
|
1040 | + $this->builder->fields()->each(function(Field $field) use ($values) { |
|
1041 | 1041 | $field->setOriginal($values); |
1042 | 1042 | }); |
1043 | 1043 | } |
@@ -1067,7 +1067,7 @@ discard block |
||
1067 | 1067 | |
1068 | 1068 | $data = $this->model->toArray(); |
1069 | 1069 | |
1070 | - $this->builder->fields()->each(function (Field $field) use ($data) { |
|
1070 | + $this->builder->fields()->each(function(Field $field) use ($data) { |
|
1071 | 1071 | if (!in_array($field->column(), $this->ignored)) { |
1072 | 1072 | $field->fill($data); |
1073 | 1073 | } |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | */ |
1212 | 1212 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
1213 | 1213 | { |
1214 | - $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
1214 | + $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) { |
|
1215 | 1215 | /* @var Field $field */ |
1216 | 1216 | $field->setWidth($fieldWidth, $labelWidth); |
1217 | 1217 | }); |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | array_unshift($segments, $basePath); |
1397 | 1397 | } |
1398 | 1398 | |
1399 | - return '/' . implode('/', $segments); |
|
1399 | + return '/'.implode('/', $segments); |
|
1400 | 1400 | } |
1401 | 1401 | |
1402 | 1402 | /** |