@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * @param $permission |
| 14 | 14 | * |
| 15 | - * @return true |
|
| 15 | + * @return boolean|null |
|
| 16 | 16 | */ |
| 17 | 17 | public static function check($permission) |
| 18 | 18 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @param $roles |
| 32 | 32 | * |
| 33 | - * @return true |
|
| 33 | + * @return boolean|null |
|
| 34 | 34 | */ |
| 35 | 35 | public static function allow($roles) |
| 36 | 36 | { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @param $roles |
| 50 | 50 | * |
| 51 | - * @return true |
|
| 51 | + * @return boolean|null |
|
| 52 | 52 | */ |
| 53 | 53 | public static function deny($roles) |
| 54 | 54 | { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (is_array($permission)) { |
| 24 | - collect($permission)->each(function ($permission) { |
|
| 24 | + collect($permission)->each(function($permission) { |
|
| 25 | 25 | call_user_func([Permission::class, 'check'], $permission); |
| 26 | 26 | }); |
| 27 | 27 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | protected static function error() |
| 76 | 76 | { |
| 77 | - $content = Admin::content(function ($content) { |
|
| 77 | + $content = Admin::content(function($content) { |
|
| 78 | 78 | $content->body(view('admin::deny')); |
| 79 | 79 | }); |
| 80 | 80 | |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | $attributes = $this->attributes; |
| 66 | 66 | $attributes['namespace'] = 'Encore\Admin\Controllers'; |
| 67 | 67 | |
| 68 | - $this->router->group($attributes, function ($router) { |
|
| 68 | + $this->router->group($attributes, function($router) { |
|
| 69 | 69 | |
| 70 | 70 | $attributes = ['middleware' => 'admin.permission:allow,administrator']; |
| 71 | 71 | |
| 72 | - $router->group($attributes, function ($router) { |
|
| 72 | + $router->group($attributes, function($router) { |
|
| 73 | 73 | $router->resources([ |
| 74 | 74 | 'auth/users' => 'UserController', |
| 75 | 75 | 'auth/roles' => 'RoleController', |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function register() |
| 94 | 94 | { |
| 95 | - $this->router->group($this->attributes, function ($router) { |
|
| 95 | + $this->router->group($this->attributes, function($router) { |
|
| 96 | 96 | foreach ($this->routes as $method => $arguments) { |
| 97 | 97 | foreach ($arguments as $argument) { |
| 98 | 98 | call_user_func_array([$router, $method], $argument); |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | */ |
| 106 | 106 | protected function decodeUtf8HtmlEntities($html) |
| 107 | 107 | { |
| 108 | - return preg_replace_callback('/(&#[0-9]+;)/', function ($html) { |
|
| 108 | + return preg_replace_callback('/(&#[0-9]+;)/', function($html) { |
|
| 109 | 109 | return mb_convert_encoding($html[1], 'UTF-8', 'HTML-ENTITIES'); |
| 110 | 110 | }, $html); |
| 111 | 111 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | * |
| 267 | 267 | * @param UploadedFile $file |
| 268 | 268 | * |
| 269 | - * @return mixed|string |
|
| 269 | + * @return string |
|
| 270 | 270 | */ |
| 271 | 271 | protected function prepareForSingle(UploadedFile $file = null) |
| 272 | 272 | { |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * |
| 309 | 309 | * @param UploadedFile $file |
| 310 | 310 | * |
| 311 | - * @return mixed |
|
| 311 | + * @return string |
|
| 312 | 312 | */ |
| 313 | 313 | protected function uploadAndDeleteOriginal(UploadedFile $file) |
| 314 | 314 | { |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | /** |
| 364 | 364 | * Get file visit url. |
| 365 | 365 | * |
| 366 | - * @param $path |
|
| 366 | + * @param string $path |
|
| 367 | 367 | * @return string |
| 368 | 368 | */ |
| 369 | 369 | public function objectUrl($path) |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | /** |
| 77 | 77 | * @param $file |
| 78 | 78 | * |
| 79 | - * @return mixed |
|
| 79 | + * @return string |
|
| 80 | 80 | */ |
| 81 | 81 | protected function uploadAndDeleteOriginal(UploadedFile $file) |
| 82 | 82 | { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * Create a new grid instance. |
| 189 | 189 | * |
| 190 | 190 | * @param Eloquent $model |
| 191 | - * @param callable $builder |
|
| 191 | + * @param Closure $builder |
|
| 192 | 192 | */ |
| 193 | 193 | public function __construct(Eloquent $model, Closure $builder) |
| 194 | 194 | { |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | /** |
| 405 | 405 | * Set grid row callback function. |
| 406 | 406 | * |
| 407 | - * @param callable $callable |
|
| 407 | + * @param Closure $callable |
|
| 408 | 408 | * |
| 409 | 409 | * @return Collection|void |
| 410 | 410 | */ |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | /** |
| 624 | 624 | * Set the grid filter. |
| 625 | 625 | * |
| 626 | - * @param callable $callback |
|
| 626 | + * @param Closure $callback |
|
| 627 | 627 | */ |
| 628 | 628 | public function filter(Closure $callback) |
| 629 | 629 | { |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | $data = $this->processFilter(); |
| 357 | 357 | |
| 358 | - $this->columns->map(function (Column $column) use (&$data) { |
|
| 358 | + $this->columns->map(function(Column $column) use (&$data) { |
|
| 359 | 359 | $data = $column->fill($data); |
| 360 | 360 | |
| 361 | 361 | $this->columnNames[] = $column->getName(); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | protected function buildRows(array $data) |
| 389 | 389 | { |
| 390 | - $this->rows = collect($data)->map(function ($val, $key) { |
|
| 390 | + $this->rows = collect($data)->map(function($val, $key) { |
|
| 391 | 391 | $row = new Row($key, $val); |
| 392 | 392 | |
| 393 | 393 | $row->setKeyName($this->keyName); |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | ->push($perPage) |
| 672 | 672 | ->unique() |
| 673 | 673 | ->sort() |
| 674 | - ->map(function ($option) use ($perPage) { |
|
| 674 | + ->map(function($option) use ($perPage) { |
|
| 675 | 675 | $selected = ($option == $perPage) ? 'selected' : ''; |
| 676 | 676 | $url = app('request')->fullUrlWithQuery([$this->model->getPerPageName() => $option]); |
| 677 | 677 | |
@@ -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 | */ |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $this->setSort(); |
| 195 | 195 | $this->setPaginate(); |
| 196 | 196 | |
| 197 | - $this->queries->unique()->each(function ($query) { |
|
| 197 | + $this->queries->unique()->each(function($query) { |
|
| 198 | 198 | $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); |
| 199 | 199 | }); |
| 200 | 200 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | $paginate = $this->findQueryByMethod('paginate'); |
| 220 | 220 | |
| 221 | - $this->queries = $this->queries->reject(function ($query) { |
|
| 221 | + $this->queries = $this->queries->reject(function($query) { |
|
| 222 | 222 | return $query['method'] == 'paginate'; |
| 223 | 223 | }); |
| 224 | 224 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | protected function findQueryByMethod($method) |
| 270 | 270 | { |
| 271 | - return $this->queries->first(function ($query) use ($method) { |
|
| 271 | + return $this->queries->first(function($query) use ($method) { |
|
| 272 | 272 | return $query['method'] == $method; |
| 273 | 273 | }); |
| 274 | 274 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | { |
| 314 | 314 | list($relationName, $relationColumn) = explode('.', $column); |
| 315 | 315 | |
| 316 | - if ($this->queries->contains(function ($query) use ($relationName) { |
|
| 316 | + if ($this->queries->contains(function($query) use ($relationName) { |
|
| 317 | 317 | return $query['method'] == 'with' && in_array($relationName, $query['arguments']); |
| 318 | 318 | })) { |
| 319 | 319 | $relation = $this->model->$relationName(); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | public function resetOrderBy() |
| 344 | 344 | { |
| 345 | - $this->queries = $this->queries->reject(function ($query) { |
|
| 345 | + $this->queries = $this->queries->reject(function($query) { |
|
| 346 | 346 | return $query['method'] == 'orderBy'; |
| 347 | 347 | }); |
| 348 | 348 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | public function button($style = 'default') |
| 236 | 236 | { |
| 237 | 237 | if (is_array($style)) { |
| 238 | - $style = array_map(function ($style) { |
|
| 238 | + $style = array_map(function($style) { |
|
| 239 | 239 | return 'btn-'.$style; |
| 240 | 240 | }, $style); |
| 241 | 241 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | public function progressBar($style = 'primary', $size = 'sm', $max = 100) |
| 264 | 264 | { |
| 265 | 265 | if (is_array($style)) { |
| 266 | - $style = array_map(function ($style) { |
|
| 266 | + $style = array_map(function($style) { |
|
| 267 | 267 | return 'progress-bar-'.$style; |
| 268 | 268 | }, $style); |
| 269 | 269 | |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | protected function htmlEntityEncode($item) |
| 442 | 442 | { |
| 443 | 443 | if (is_array($item)) { |
| 444 | - array_walk_recursive($item, function (&$value) { |
|
| 444 | + array_walk_recursive($item, function(&$value) { |
|
| 445 | 445 | $value = htmlentities($value); |
| 446 | 446 | }); |
| 447 | 447 | } else { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | $connection = config('admin.database.connection') ?: config('database.default'); |
| 16 | 16 | |
| 17 | - Schema::connection($connection)->create(config('admin.database.users_table'), function (Blueprint $table) { |
|
| 17 | + Schema::connection($connection)->create(config('admin.database.users_table'), function(Blueprint $table) { |
|
| 18 | 18 | $table->increments('id'); |
| 19 | 19 | $table->string('username', 190)->unique(); |
| 20 | 20 | $table->string('password', 60); |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | $table->timestamps(); |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | - Schema::connection($connection)->create(config('admin.database.roles_table'), function (Blueprint $table) { |
|
| 26 | + Schema::connection($connection)->create(config('admin.database.roles_table'), function(Blueprint $table) { |
|
| 27 | 27 | $table->increments('id'); |
| 28 | 28 | $table->string('name', 50)->unique(); |
| 29 | 29 | $table->string('slug', 50); |
| 30 | 30 | $table->timestamps(); |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | - Schema::connection($connection)->create(config('admin.database.permissions_table'), function (Blueprint $table) { |
|
| 33 | + Schema::connection($connection)->create(config('admin.database.permissions_table'), function(Blueprint $table) { |
|
| 34 | 34 | $table->increments('id'); |
| 35 | 35 | $table->string('name', 50)->unique(); |
| 36 | 36 | $table->string('slug', 50); |
| 37 | 37 | $table->timestamps(); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - Schema::connection($connection)->create(config('admin.database.menu_table'), function (Blueprint $table) { |
|
| 40 | + Schema::connection($connection)->create(config('admin.database.menu_table'), function(Blueprint $table) { |
|
| 41 | 41 | $table->increments('id'); |
| 42 | 42 | $table->integer('parent_id')->default(0); |
| 43 | 43 | $table->integer('order')->default(0); |
@@ -48,35 +48,35 @@ discard block |
||
| 48 | 48 | $table->timestamps(); |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | - Schema::connection($connection)->create(config('admin.database.role_users_table'), function (Blueprint $table) { |
|
| 51 | + Schema::connection($connection)->create(config('admin.database.role_users_table'), function(Blueprint $table) { |
|
| 52 | 52 | $table->integer('role_id'); |
| 53 | 53 | $table->integer('user_id'); |
| 54 | 54 | $table->index(['role_id', 'user_id']); |
| 55 | 55 | $table->timestamps(); |
| 56 | 56 | }); |
| 57 | 57 | |
| 58 | - Schema::connection($connection)->create(config('admin.database.role_permissions_table'), function (Blueprint $table) { |
|
| 58 | + Schema::connection($connection)->create(config('admin.database.role_permissions_table'), function(Blueprint $table) { |
|
| 59 | 59 | $table->integer('role_id'); |
| 60 | 60 | $table->integer('permission_id'); |
| 61 | 61 | $table->index(['role_id', 'permission_id']); |
| 62 | 62 | $table->timestamps(); |
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | - Schema::connection($connection)->create(config('admin.database.user_permissions_table'), function (Blueprint $table) { |
|
| 65 | + Schema::connection($connection)->create(config('admin.database.user_permissions_table'), function(Blueprint $table) { |
|
| 66 | 66 | $table->integer('user_id'); |
| 67 | 67 | $table->integer('permission_id'); |
| 68 | 68 | $table->index(['user_id', 'permission_id']); |
| 69 | 69 | $table->timestamps(); |
| 70 | 70 | }); |
| 71 | 71 | |
| 72 | - Schema::connection($connection)->create(config('admin.database.role_menu_table'), function (Blueprint $table) { |
|
| 72 | + Schema::connection($connection)->create(config('admin.database.role_menu_table'), function(Blueprint $table) { |
|
| 73 | 73 | $table->integer('role_id'); |
| 74 | 74 | $table->integer('menu_id'); |
| 75 | 75 | $table->index(['role_id', 'menu_id']); |
| 76 | 76 | $table->timestamps(); |
| 77 | 77 | }); |
| 78 | 78 | |
| 79 | - Schema::connection($connection)->create(config('admin.database.operation_log_table'), function (Blueprint $table) { |
|
| 79 | + Schema::connection($connection)->create(config('admin.database.operation_log_table'), function(Blueprint $table) { |
|
| 80 | 80 | $table->increments('id'); |
| 81 | 81 | $table->integer('user_id'); |
| 82 | 82 | $table->string('path'); |