@@ -58,7 +58,7 @@ |
||
58 | 58 | /** |
59 | 59 | * User logout. |
60 | 60 | * |
61 | - * @return Redirect |
|
61 | + * @return \Illuminate\Http\RedirectResponse |
|
62 | 62 | */ |
63 | 63 | public function getLogout() |
64 | 64 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getSetting() |
78 | 78 | { |
79 | - return Admin::content(function (Content $content) { |
|
79 | + return Admin::content(function(Content $content) { |
|
80 | 80 | $content->header(trans('admin.user_setting')); |
81 | 81 | $content->body($this->settingForm()->edit(Admin::user()->id)); |
82 | 82 | }); |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | */ |
100 | 100 | protected function settingForm() |
101 | 101 | { |
102 | - return Administrator::form(function (Form $form) { |
|
102 | + return Administrator::form(function(Form $form) { |
|
103 | 103 | $form->display('username', trans('admin.username')); |
104 | 104 | $form->text('name', trans('admin.name'))->rules('required'); |
105 | 105 | $form->image('avatar', trans('admin.avatar')); |
106 | 106 | $form->password('password', trans('admin.password'))->rules('confirmed|required'); |
107 | 107 | $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required') |
108 | - ->default(function ($form) { |
|
108 | + ->default(function($form) { |
|
109 | 109 | return $form->model()->password; |
110 | 110 | }); |
111 | 111 | |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | |
114 | 114 | $form->ignore(['password_confirmation']); |
115 | 115 | |
116 | - $form->saving(function (Form $form) { |
|
116 | + $form->saving(function(Form $form) { |
|
117 | 117 | if ($form->password && $form->model()->password != $form->password) { |
118 | 118 | $form->password = bcrypt($form->password); |
119 | 119 | } |
120 | 120 | }); |
121 | 121 | |
122 | - $form->saved(function () { |
|
122 | + $form->saved(function() { |
|
123 | 123 | admin_toastr(trans('admin.update_succeeded')); |
124 | 124 | |
125 | 125 | return redirect(admin_base_path('auth/setting')); |
@@ -131,7 +131,7 @@ |
||
131 | 131 | /** |
132 | 132 | * Get options of HTTP methods select field. |
133 | 133 | * |
134 | - * @return array |
|
134 | + * @return callable |
|
135 | 135 | */ |
136 | 136 | protected function getHttpMethodsOptions() |
137 | 137 | { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function index() |
23 | 23 | { |
24 | - return Admin::content(function (Content $content) { |
|
24 | + return Admin::content(function(Content $content) { |
|
25 | 25 | $content->header(trans('admin.permissions')); |
26 | 26 | $content->description(trans('admin.list')); |
27 | 27 | $content->body($this->grid()->render()); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function edit($id) |
39 | 39 | { |
40 | - return Admin::content(function (Content $content) use ($id) { |
|
40 | + return Admin::content(function(Content $content) use ($id) { |
|
41 | 41 | $content->header(trans('admin.permissions')); |
42 | 42 | $content->description(trans('admin.edit')); |
43 | 43 | $content->body($this->form()->edit($id)); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function create() |
53 | 53 | { |
54 | - return Admin::content(function (Content $content) { |
|
54 | + return Admin::content(function(Content $content) { |
|
55 | 55 | $content->header(trans('admin.permissions')); |
56 | 56 | $content->description(trans('admin.create')); |
57 | 57 | $content->body($this->form()); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | */ |
66 | 66 | protected function grid() |
67 | 67 | { |
68 | - return Admin::grid(Permission::class, function (Grid $grid) { |
|
68 | + return Admin::grid(Permission::class, function(Grid $grid) { |
|
69 | 69 | $grid->id('ID')->sortable(); |
70 | 70 | $grid->slug(trans('admin.slug')); |
71 | 71 | $grid->name(trans('admin.name')); |
72 | 72 | |
73 | - $grid->http_path(trans('admin.route'))->display(function ($path) { |
|
74 | - return collect(explode("\r\n", $path))->map(function ($path) { |
|
73 | + $grid->http_path(trans('admin.route'))->display(function($path) { |
|
74 | + return collect(explode("\r\n", $path))->map(function($path) { |
|
75 | 75 | $method = $this->http_method ?: ['ANY']; |
76 | 76 | |
77 | 77 | if (Str::contains($path, ':')) { |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | $method = explode(',', $method); |
80 | 80 | } |
81 | 81 | |
82 | - $method = collect($method)->map(function ($name) { |
|
82 | + $method = collect($method)->map(function($name) { |
|
83 | 83 | return strtoupper($name); |
84 | - })->map(function ($name) { |
|
84 | + })->map(function($name) { |
|
85 | 85 | return "<span class='label label-primary'>{$name}</span>"; |
86 | 86 | })->implode(' '); |
87 | 87 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | $grid->created_at(trans('admin.created_at')); |
95 | 95 | $grid->updated_at(trans('admin.updated_at')); |
96 | 96 | |
97 | - $grid->tools(function (Grid\Tools $tools) { |
|
98 | - $tools->batch(function (Grid\Tools\BatchActions $actions) { |
|
97 | + $grid->tools(function(Grid\Tools $tools) { |
|
98 | + $tools->batch(function(Grid\Tools\BatchActions $actions) { |
|
99 | 99 | $actions->disableDelete(); |
100 | 100 | }); |
101 | 101 | }); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function form() |
111 | 111 | { |
112 | - return Admin::form(Permission::class, function (Form $form) { |
|
112 | + return Admin::form(Permission::class, function(Form $form) { |
|
113 | 113 | $form->display('id', 'ID'); |
114 | 114 | |
115 | 115 | $form->text('slug', trans('admin.slug'))->rules('required'); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @param $id |
280 | 280 | * |
281 | - * @return mixed |
|
281 | + * @return boolean |
|
282 | 282 | */ |
283 | 283 | public function destroy($id) |
284 | 284 | { |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | /** |
318 | 318 | * Store a new record. |
319 | 319 | * |
320 | - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\Http\JsonResponse |
|
320 | + * @return Response |
|
321 | 321 | */ |
322 | 322 | public function store() |
323 | 323 | { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * |
397 | 397 | * @param array $data |
398 | 398 | * |
399 | - * @return mixed |
|
399 | + * @return Response|null |
|
400 | 400 | */ |
401 | 401 | protected function prepare($data = []) |
402 | 402 | { |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | /** |
855 | 855 | * Set saved callback. |
856 | 856 | * |
857 | - * @param callable $callback |
|
857 | + * @param Closure $callback |
|
858 | 858 | * |
859 | 859 | * @return void |
860 | 860 | */ |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | $data = $this->model->with($this->getRelations()) |
306 | 306 | ->findOrFail($id)->toArray(); |
307 | 307 | |
308 | - $this->builder->fields()->filter(function ($field) { |
|
308 | + $this->builder->fields()->filter(function($field) { |
|
309 | 309 | return $field instanceof Field\File; |
310 | - })->each(function (File $file) use ($data) { |
|
310 | + })->each(function(File $file) use ($data) { |
|
311 | 311 | $file->setOriginal($data); |
312 | 312 | |
313 | 313 | $file->destroy(); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | return $response; |
333 | 333 | } |
334 | 334 | |
335 | - DB::transaction(function () { |
|
335 | + DB::transaction(function() { |
|
336 | 336 | $inserts = $this->prepareInsert($this->updates); |
337 | 337 | |
338 | 338 | foreach ($inserts as $column => $value) { |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | return $response; |
528 | 528 | } |
529 | 529 | |
530 | - DB::transaction(function () { |
|
530 | + DB::transaction(function() { |
|
531 | 531 | $updates = $this->prepareUpdate($this->updates); |
532 | 532 | |
533 | 533 | foreach ($updates as $column => $value) { |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | protected function getFieldByColumn($column) |
913 | 913 | { |
914 | 914 | return $this->builder->fields()->first( |
915 | - function (Field $field) use ($column) { |
|
915 | + function(Field $field) use ($column) { |
|
916 | 916 | if (is_array($field->column())) { |
917 | 917 | return in_array($column, $field->column()); |
918 | 918 | } |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | { |
932 | 932 | $values = $this->model->toArray(); |
933 | 933 | |
934 | - $this->builder->fields()->each(function (Field $field) use ($values) { |
|
934 | + $this->builder->fields()->each(function(Field $field) use ($values) { |
|
935 | 935 | $field->setOriginal($values); |
936 | 936 | }); |
937 | 937 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | |
952 | 952 | $data = $this->model->toArray(); |
953 | 953 | |
954 | - $this->builder->fields()->each(function (Field $field) use ($data) { |
|
954 | + $this->builder->fields()->each(function(Field $field) use ($data) { |
|
955 | 955 | $field->fill($data); |
956 | 956 | }); |
957 | 957 | } |
@@ -1054,7 +1054,7 @@ discard block |
||
1054 | 1054 | */ |
1055 | 1055 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
1056 | 1056 | { |
1057 | - $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
1057 | + $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) { |
|
1058 | 1058 | /* @var Field $field */ |
1059 | 1059 | $field->setWidth($fieldWidth, $labelWidth); |
1060 | 1060 | }); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | /** |
133 | 133 | * Returns builder is $mode. |
134 | 134 | * |
135 | - * @param $mode |
|
135 | + * @param string $mode |
|
136 | 136 | * |
137 | 137 | * @return bool |
138 | 138 | */ |
@@ -154,6 +154,7 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | + * @param integer $slice |
|
157 | 158 | * @return string |
158 | 159 | */ |
159 | 160 | public function getResource($slice = null) |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function field($name) |
251 | 251 | { |
252 | - return $this->fields()->first(function (Field $field) use ($name) { |
|
252 | + return $this->fields()->first(function(Field $field) use ($name) { |
|
253 | 253 | return $field->column() == $name; |
254 | 254 | }); |
255 | 255 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | $this->form->model()->getUpdatedAtColumn(), |
491 | 491 | ]; |
492 | 492 | |
493 | - $this->fields = $this->fields()->reject(function (Field $field) use ($reservedColumns) { |
|
493 | + $this->fields = $this->fields()->reject(function(Field $field) use ($reservedColumns) { |
|
494 | 494 | return in_array($field->column(), $reservedColumns); |
495 | 495 | }); |
496 | 496 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | /** |
177 | 177 | * Field constructor. |
178 | 178 | * |
179 | - * @param $column |
|
179 | + * @param string $column |
|
180 | 180 | * @param array $arguments |
181 | 181 | */ |
182 | 182 | public function __construct($column, $arguments = []) |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | /** |
376 | 376 | * Get or set rules. |
377 | 377 | * |
378 | - * @param null $rules |
|
378 | + * @param string $rules |
|
379 | 379 | * |
380 | 380 | * @return mixed |
381 | 381 | */ |
@@ -590,8 +590,8 @@ discard block |
||
590 | 590 | /** |
591 | 591 | * Add html attributes to elements. |
592 | 592 | * |
593 | - * @param array|string $attribute |
|
594 | - * @param mixed $value |
|
593 | + * @param string $attribute |
|
594 | + * @param boolean|string $value |
|
595 | 595 | * |
596 | 596 | * @return $this |
597 | 597 | */ |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * |
22 | 22 | * @param array|callable|string $options |
23 | 23 | * |
24 | - * @return $this|mixed |
|
24 | + * @return Checkbox |
|
25 | 25 | */ |
26 | 26 | public function options($options = []) |
27 | 27 | { |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @param string $target |
30 | 30 | * |
31 | - * @return mixed |
|
31 | + * @return string |
|
32 | 32 | */ |
33 | 33 | public function callInterventionMethods($target) |
34 | 34 | { |
@@ -8,6 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | protected $append; |
10 | 10 | |
11 | + /** |
|
12 | + * @param string $string |
|
13 | + */ |
|
11 | 14 | public function prepend($string) |
12 | 15 | { |
13 | 16 | if (is_null($this->prepend)) { |
@@ -17,6 +20,9 @@ discard block |
||
17 | 20 | return $this; |
18 | 21 | } |
19 | 22 | |
23 | + /** |
|
24 | + * @param string $string |
|
25 | + */ |
|
20 | 26 | public function append($string) |
21 | 27 | { |
22 | 28 | if (is_null($this->append)) { |
@@ -33,6 +39,9 @@ discard block |
||
33 | 39 | } |
34 | 40 | } |
35 | 41 | |
42 | + /** |
|
43 | + * @param string $attribute |
|
44 | + */ |
|
36 | 45 | protected function defaultAttribute($attribute, $value) |
37 | 46 | { |
38 | 47 | if (!array_key_exists($attribute, $this->attributes)) { |
@@ -292,7 +292,7 @@ |
||
292 | 292 | /** |
293 | 293 | * Get the html and script of template. |
294 | 294 | * |
295 | - * @return array |
|
295 | + * @return string[] |
|
296 | 296 | */ |
297 | 297 | public function getTemplateHtmlAndScript() |
298 | 298 | { |
@@ -173,7 +173,7 @@ |
||
173 | 173 | if (array_key_exists($key, $this->original)) { |
174 | 174 | $values = $this->original[$key]; |
175 | 175 | } |
176 | - $this->fields->each(function (Field $field) use ($values) { |
|
176 | + $this->fields->each(function(Field $field) use ($values) { |
|
177 | 177 | $field->setOriginal($values); |
178 | 178 | }); |
179 | 179 | } |