| @@ -54,7 +54,7 @@ | ||
| 54 | 54 | |
| 55 | 55 | $this->value = array_get($inputs, $this->column); | 
| 56 | 56 | |
| 57 | -        $value = array_filter($this->value, function ($val) { | |
| 57 | +        $value = array_filter($this->value, function($val) { | |
| 58 | 58 | return $val !== ''; | 
| 59 | 59 | }); | 
| 60 | 60 | |
| @@ -158,7 +158,7 @@ | ||
| 158 | 158 | |
| 159 | 159 |          list($relation, $args[0]) = explode('.', $this->column); | 
| 160 | 160 | |
| 161 | -        return ['whereHas' => [$relation, function ($relation) use ($args) { | |
| 161 | +        return ['whereHas' => [$relation, function($relation) use ($args) { | |
| 162 | 162 | call_user_func_array([$relation, $this->query], $args); | 
| 163 | 163 | }]]; | 
| 164 | 164 | } | 
| @@ -331,7 +331,7 @@ | ||
| 331 | 331 | * | 
| 332 | 332 | * @param Presenter $presenter | 
| 333 | 333 | * | 
| 334 | - * @return mixed | |
| 334 | + * @return Presenter | |
| 335 | 335 | */ | 
| 336 | 336 | protected function setPresenter(Presenter $presenter) | 
| 337 | 337 |      { | 
| @@ -134,7 +134,7 @@ | ||
| 134 | 134 | public function style($style) | 
| 135 | 135 |      { | 
| 136 | 136 |          if (is_array($style)) { | 
| 137 | -            $style = implode('', array_map(function ($key, $val) { | |
| 137 | +            $style = implode('', array_map(function($key, $val) { | |
| 138 | 138 | return "$key:$val"; | 
| 139 | 139 | }, array_keys($style), array_values($style))); | 
| 140 | 140 | } | 
| @@ -64,7 +64,7 @@ | ||
| 64 | 64 | return $this->style([$styles]); | 
| 65 | 65 | } | 
| 66 | 66 | |
| 67 | -        $styles = array_map(function ($style) { | |
| 67 | +        $styles = array_map(function($style) { | |
| 68 | 68 | return 'box-'.$style; | 
| 69 | 69 | }, $styles); | 
| 70 | 70 | |
| @@ -117,7 +117,7 @@ | ||
| 117 | 117 | /** | 
| 118 | 118 | * Add form attributes. | 
| 119 | 119 | * | 
| 120 | - * @param string|array $attr | |
| 120 | + * @param string $attr | |
| 121 | 121 | * @param string $value | 
| 122 | 122 | * | 
| 123 | 123 | * @return $this | 
| @@ -162,7 +162,7 @@ | ||
| 162 | 162 | */ | 
| 163 | 163 | public function setWidth($fieldWidth = 8, $labelWidth = 2) | 
| 164 | 164 |      { | 
| 165 | -        collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) { | |
| 165 | +        collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) { | |
| 166 | 166 | /* @var Field $field */ | 
| 167 | 167 | $field->setWidth($fieldWidth, $labelWidth); | 
| 168 | 168 | }); | 
| @@ -240,7 +240,7 @@ discard block | ||
| 240 | 240 | /** | 
| 241 | 241 | * Resolve perPage for pagination. | 
| 242 | 242 | * | 
| 243 | - * @param array|null $paginate | |
| 243 | + * @param Model $paginate | |
| 244 | 244 | * | 
| 245 | 245 | * @return array | 
| 246 | 246 | */ | 
| @@ -262,7 +262,7 @@ discard block | ||
| 262 | 262 | /** | 
| 263 | 263 | * Find query by method name. | 
| 264 | 264 | * | 
| 265 | - * @param $method | |
| 265 | + * @param string $method | |
| 266 | 266 | * | 
| 267 | 267 | * @return static | 
| 268 | 268 | */ | 
| @@ -225,9 +225,9 @@ discard block | ||
| 225 | 225 | |
| 226 | 226 | $this->setSort(); | 
| 227 | 227 | |
| 228 | -        $this->queries->reject(function ($query) { | |
| 228 | +        $this->queries->reject(function($query) { | |
| 229 | 229 | return $query['method'] == 'paginate'; | 
| 230 | -        })->each(function ($query) { | |
| 230 | +        })->each(function($query) { | |
| 231 | 231 |              $this->model = $this->model->{$query['method']}(...$query['arguments']); | 
| 232 | 232 | }); | 
| 233 | 233 | |
| @@ -274,7 +274,7 @@ discard block | ||
| 274 | 274 | $this->setSort(); | 
| 275 | 275 | $this->setPaginate(); | 
| 276 | 276 | |
| 277 | -        $this->queries->unique()->each(function ($query) { | |
| 277 | +        $this->queries->unique()->each(function($query) { | |
| 278 | 278 | $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); | 
| 279 | 279 | }); | 
| 280 | 280 | |
| @@ -318,7 +318,7 @@ discard block | ||
| 318 | 318 |      { | 
| 319 | 319 |          $paginate = $this->findQueryByMethod('paginate'); | 
| 320 | 320 | |
| 321 | -        $this->queries = $this->queries->reject(function ($query) { | |
| 321 | +        $this->queries = $this->queries->reject(function($query) { | |
| 322 | 322 | return $query['method'] == 'paginate'; | 
| 323 | 323 | }); | 
| 324 | 324 | |
| @@ -372,7 +372,7 @@ discard block | ||
| 372 | 372 | */ | 
| 373 | 373 | protected function findQueryByMethod($method) | 
| 374 | 374 |      { | 
| 375 | -        return $this->queries->first(function ($query) use ($method) { | |
| 375 | +        return $this->queries->first(function($query) use ($method) { | |
| 376 | 376 | return $query['method'] == $method; | 
| 377 | 377 | }); | 
| 378 | 378 | } | 
| @@ -416,7 +416,7 @@ discard block | ||
| 416 | 416 |      { | 
| 417 | 417 |          list($relationName, $relationColumn) = explode('.', $column); | 
| 418 | 418 | |
| 419 | -        if ($this->queries->contains(function ($query) use ($relationName) { | |
| 419 | +        if ($this->queries->contains(function($query) use ($relationName) { | |
| 420 | 420 | return $query['method'] == 'with' && in_array($relationName, $query['arguments']); | 
| 421 | 421 |          })) { | 
| 422 | 422 | $relation = $this->model->$relationName(); | 
| @@ -445,7 +445,7 @@ discard block | ||
| 445 | 445 | */ | 
| 446 | 446 | public function resetOrderBy() | 
| 447 | 447 |      { | 
| 448 | -        $this->queries = $this->queries->reject(function ($query) { | |
| 448 | +        $this->queries = $this->queries->reject(function($query) { | |
| 449 | 449 | return $query['method'] == 'orderBy' || $query['method'] == 'orderByDesc'; | 
| 450 | 450 | }); | 
| 451 | 451 | } | 
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | /** | 
| 26 | 26 | * Execute the console command. | 
| 27 | 27 | * | 
| 28 | - * @return void | |
| 28 | + * @return false|null | |
| 29 | 29 | */ | 
| 30 | 30 | public function handle() | 
| 31 | 31 |      { | 
| @@ -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) { | 
| @@ -907,7 +907,7 @@ discard block | ||
| 907 | 907 | protected function getFieldByColumn($column) | 
| 908 | 908 |      { | 
| 909 | 909 | return $this->builder->fields()->first( | 
| 910 | -            function (Field $field) use ($column) { | |
| 910 | +            function(Field $field) use ($column) { | |
| 911 | 911 |                  if (is_array($field->column())) { | 
| 912 | 912 | return in_array($column, $field->column()); | 
| 913 | 913 | } | 
| @@ -928,7 +928,7 @@ discard block | ||
| 928 | 928 | |
| 929 | 929 | $values = $this->model->toArray(); | 
| 930 | 930 | |
| 931 | -        $this->builder->fields()->each(function (Field $field) use ($values) { | |
| 931 | +        $this->builder->fields()->each(function(Field $field) use ($values) { | |
| 932 | 932 | $field->setOriginal($values); | 
| 933 | 933 | }); | 
| 934 | 934 | } | 
| @@ -950,7 +950,7 @@ discard block | ||
| 950 | 950 | |
| 951 | 951 | $data = $this->model->toArray(); | 
| 952 | 952 | |
| 953 | -        $this->builder->fields()->each(function (Field $field) use ($data) { | |
| 953 | +        $this->builder->fields()->each(function(Field $field) use ($data) { | |
| 954 | 954 | $field->fill($data); | 
| 955 | 955 | }); | 
| 956 | 956 | } | 
| @@ -1067,7 +1067,7 @@ discard block | ||
| 1067 | 1067 | */ | 
| 1068 | 1068 | public function setWidth($fieldWidth = 8, $labelWidth = 2) | 
| 1069 | 1069 |      { | 
| 1070 | -        $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) { | |
| 1070 | +        $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) { | |
| 1071 | 1071 | /* @var Field $field */ | 
| 1072 | 1072 | $field->setWidth($fieldWidth, $labelWidth); | 
| 1073 | 1073 | }); |