@@ -18,23 +18,23 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function index() |
| 20 | 20 | { |
| 21 | - return Admin::content(function (Content $content) { |
|
| 21 | + return Admin::content(function(Content $content) { |
|
| 22 | 22 | $content->header(trans('admin::lang.operation_log')); |
| 23 | 23 | $content->description(trans('admin::lang.list')); |
| 24 | 24 | |
| 25 | - $grid = Admin::grid(OperationLog::class, function (Grid $grid) { |
|
| 25 | + $grid = Admin::grid(OperationLog::class, function(Grid $grid) { |
|
| 26 | 26 | $grid->model()->orderBy('id', 'DESC'); |
| 27 | 27 | |
| 28 | 28 | $grid->id('ID')->sortable(); |
| 29 | 29 | $grid->user()->name(); |
| 30 | - $grid->method()->value(function ($method) { |
|
| 30 | + $grid->method()->value(function($method) { |
|
| 31 | 31 | $color = array_get(OperationLog::$methodColors, $method, 'grey'); |
| 32 | 32 | |
| 33 | 33 | return "<span class=\"badge bg-$color\">$method</span>"; |
| 34 | 34 | }); |
| 35 | 35 | $grid->path()->label('info'); |
| 36 | 36 | $grid->ip()->label('primary'); |
| 37 | - $grid->input()->value(function ($input) { |
|
| 37 | + $grid->input()->value(function($input) { |
|
| 38 | 38 | $input = json_decode($input, true); |
| 39 | 39 | $input = array_except($input, '_pjax'); |
| 40 | 40 | |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $grid->created_at(trans('admin::lang.created_at')); |
| 45 | 45 | |
| 46 | - $grid->rows(function ($row) { |
|
| 46 | + $grid->rows(function($row) { |
|
| 47 | 47 | $row->actions('delete'); |
| 48 | 48 | }); |
| 49 | 49 | |
| 50 | - $grid->filter(function ($filter) { |
|
| 50 | + $grid->filter(function($filter) { |
|
| 51 | 51 | $filter->is('user_id', 'User')->select(Administrator::all()->pluck('name', 'id')); |
| 52 | 52 | $filter->is('method')->select(array_combine(OperationLog::$methods, OperationLog::$methods)); |
| 53 | 53 | $filter->like('path'); |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function index() |
| 25 | 25 | { |
| 26 | - return Admin::content(function (Content $content) { |
|
| 26 | + return Admin::content(function(Content $content) { |
|
| 27 | 27 | $content->header(trans('admin::lang.menu')); |
| 28 | 28 | $content->description(trans('admin::lang.list')); |
| 29 | 29 | |
| 30 | - $content->row(function (Row $row) { |
|
| 31 | - $row->column(5, function (Column $column) { |
|
| 30 | + $content->row(function(Row $row) { |
|
| 31 | + $row->column(5, function(Column $column) { |
|
| 32 | 32 | $column->append($this->callout()); |
| 33 | 33 | |
| 34 | 34 | $form = new \Encore\Admin\Widgets\Form(); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function edit($id) |
| 64 | 64 | { |
| 65 | - return Admin::content(function (Content $content) use ($id) { |
|
| 65 | + return Admin::content(function(Content $content) use ($id) { |
|
| 66 | 66 | $content->header(trans('admin::lang.menu')); |
| 67 | 67 | $content->description(trans('admin::lang.edit')); |
| 68 | 68 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function form() |
| 118 | 118 | { |
| 119 | - return Admin::form(MenuModel::class, function (Form $form) { |
|
| 119 | + return Admin::form(MenuModel::class, function(Form $form) { |
|
| 120 | 120 | $form->display('id', 'ID'); |
| 121 | 121 | |
| 122 | 122 | $options = [0 => 'Root'] + MenuModel::buildSelectOptions(); |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | /** |
| 75 | 75 | * @param $id |
| 76 | 76 | * |
| 77 | - * @return $this|\Illuminate\Http\RedirectResponse |
|
| 77 | + * @return \Symfony\Component\HttpFoundation\Response |
|
| 78 | 78 | */ |
| 79 | 79 | public function update($id) |
| 80 | 80 | { |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | */ |
| 69 | 69 | protected function sanitize(array $row) |
| 70 | 70 | { |
| 71 | - return collect($row)->reject(function ($val, $_) { |
|
| 71 | + return collect($row)->reject(function($val, $_) { |
|
| 72 | 72 | |
| 73 | 73 | return is_array($val) && !Arr::isAssoc($val); |
| 74 | 74 | |
@@ -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); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create(config('admin.database.users_table'), function (Blueprint $table) { |
|
| 15 | + Schema::create(config('admin.database.users_table'), function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('username', 190)->unique(); |
| 18 | 18 | $table->string('password', 60); |
@@ -21,21 +21,21 @@ discard block |
||
| 21 | 21 | $table->timestamps(); |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | - Schema::create(config('admin.database.roles_table'), function (Blueprint $table) { |
|
| 24 | + Schema::create(config('admin.database.roles_table'), function(Blueprint $table) { |
|
| 25 | 25 | $table->increments('id'); |
| 26 | 26 | $table->string('name', 50)->unique(); |
| 27 | 27 | $table->string('slug', 50); |
| 28 | 28 | $table->timestamps(); |
| 29 | 29 | }); |
| 30 | 30 | |
| 31 | - Schema::create(config('admin.database.permissions_table'), function (Blueprint $table) { |
|
| 31 | + Schema::create(config('admin.database.permissions_table'), function(Blueprint $table) { |
|
| 32 | 32 | $table->increments('id'); |
| 33 | 33 | $table->string('name', 50)->unique(); |
| 34 | 34 | $table->string('slug', 50); |
| 35 | 35 | $table->timestamps(); |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | - Schema::create(config('admin.database.menu_table'), function (Blueprint $table) { |
|
| 38 | + Schema::create(config('admin.database.menu_table'), function(Blueprint $table) { |
|
| 39 | 39 | $table->increments('id'); |
| 40 | 40 | $table->integer('parent_id')->default(0); |
| 41 | 41 | $table->integer('order'); |
@@ -46,35 +46,35 @@ discard block |
||
| 46 | 46 | $table->timestamps(); |
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | - Schema::create(config('admin.database.role_users_table'), function (Blueprint $table) { |
|
| 49 | + Schema::create(config('admin.database.role_users_table'), function(Blueprint $table) { |
|
| 50 | 50 | $table->integer('role_id'); |
| 51 | 51 | $table->integer('user_id'); |
| 52 | 52 | $table->index(['role_id', 'user_id']); |
| 53 | 53 | $table->timestamps(); |
| 54 | 54 | }); |
| 55 | 55 | |
| 56 | - Schema::create(config('admin.database.role_permissions_table'), function (Blueprint $table) { |
|
| 56 | + Schema::create(config('admin.database.role_permissions_table'), function(Blueprint $table) { |
|
| 57 | 57 | $table->integer('role_id'); |
| 58 | 58 | $table->integer('permission_id'); |
| 59 | 59 | $table->index(['role_id', 'permission_id']); |
| 60 | 60 | $table->timestamps(); |
| 61 | 61 | }); |
| 62 | 62 | |
| 63 | - Schema::create(config('admin.database.user_permissions_table'), function (Blueprint $table) { |
|
| 63 | + Schema::create(config('admin.database.user_permissions_table'), function(Blueprint $table) { |
|
| 64 | 64 | $table->integer('user_id'); |
| 65 | 65 | $table->integer('permission_id'); |
| 66 | 66 | $table->index(['user_id', 'permission_id']); |
| 67 | 67 | $table->timestamps(); |
| 68 | 68 | }); |
| 69 | 69 | |
| 70 | - Schema::create(config('admin.database.role_menu_table'), function (Blueprint $table) { |
|
| 70 | + Schema::create(config('admin.database.role_menu_table'), function(Blueprint $table) { |
|
| 71 | 71 | $table->integer('role_id'); |
| 72 | 72 | $table->integer('menu_id'); |
| 73 | 73 | $table->index(['role_id', 'menu_id']); |
| 74 | 74 | $table->timestamps(); |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | - Schema::create(config('admin.database.operation_log_table'), function (Blueprint $table) { |
|
| 77 | + Schema::create(config('admin.database.operation_log_table'), function(Blueprint $table) { |
|
| 78 | 78 | $table->increments('id'); |
| 79 | 79 | $table->integer('user_id'); |
| 80 | 80 | $table->string('path'); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | /** |
| 282 | 282 | * Get or set rules. |
| 283 | 283 | * |
| 284 | - * @param null $rules |
|
| 284 | + * @param string $rules |
|
| 285 | 285 | * |
| 286 | 286 | * @return $this |
| 287 | 287 | */ |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | /** |
| 302 | 302 | * Set or get value of the field. |
| 303 | 303 | * |
| 304 | - * @param null $value |
|
| 304 | + * @param string $value |
|
| 305 | 305 | * |
| 306 | 306 | * @return mixed |
| 307 | 307 | */ |
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | /** |
| 350 | 350 | * Add html attributes to elements. |
| 351 | 351 | * |
| 352 | - * @param array|string $attribute |
|
| 353 | - * @param mixed $value |
|
| 352 | + * @param string $attribute |
|
| 353 | + * @param boolean $value |
|
| 354 | 354 | * |
| 355 | 355 | * @return $this |
| 356 | 356 | */ |
@@ -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 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | protected function htmlEntityEncode($item) |
| 237 | 237 | { |
| 238 | 238 | if (is_array($item)) { |
| 239 | - array_walk_recursive($item, function (&$value) { |
|
| 239 | + array_walk_recursive($item, function(&$value) { |
|
| 240 | 240 | $value = htmlentities($value); |
| 241 | 241 | }); |
| 242 | 242 | } else { |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | public function button($style = 'default') |
| 322 | 322 | { |
| 323 | 323 | if (is_array($style)) { |
| 324 | - $style = array_map(function ($style) { |
|
| 324 | + $style = array_map(function($style) { |
|
| 325 | 325 | return 'btn-'.$style; |
| 326 | 326 | }, $style); |
| 327 | 327 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | public function progressBar($style = 'primary', $size = 'sm', $max = 100) |
| 350 | 350 | { |
| 351 | 351 | if (is_array($style)) { |
| 352 | - $style = array_map(function ($style) { |
|
| 352 | + $style = array_map(function($style) { |
|
| 353 | 353 | return 'progress-bar-'.$style; |
| 354 | 354 | }, $style); |
| 355 | 355 | |