Răsfoiți Sursa

Apply fixes from StyleCI

Jiang Qinghua 6 ani în urmă
părinte
comite
0347be99c5

+ 0 - 1
src/Controllers/PermissionController.php

@@ -2,7 +2,6 @@
 
 namespace Dcat\Admin\Controllers;
 
-use Dcat\Admin\Admin;
 use Dcat\Admin\Form;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Layout\Content;

+ 0 - 1
src/Controllers/RoleController.php

@@ -2,7 +2,6 @@
 
 namespace Dcat\Admin\Controllers;
 
-use Dcat\Admin\Admin;
 use Dcat\Admin\Auth\Permission;
 use Dcat\Admin\Form;
 use Dcat\Admin\Grid;

+ 0 - 1
src/Controllers/UserController.php

@@ -2,7 +2,6 @@
 
 namespace Dcat\Admin\Controllers;
 
-use Dcat\Admin\Admin;
 use Dcat\Admin\Auth\Permission;
 use Dcat\Admin\Form;
 use Dcat\Admin\Grid;

+ 1 - 1
src/Grid/Filter/Presenter/DateTime.php

@@ -47,7 +47,7 @@ class DateTime extends Presenter
         Admin::script($script);
     }
 
-    public function variables() : array
+    public function variables(): array
     {
         $this->prepare();
 

+ 2 - 2
src/Grid/Filter/Presenter/Radio.php

@@ -41,7 +41,7 @@ class Radio extends Presenter
      *
      * @return $this
      */
-    public function stacked() : self
+    public function stacked(): self
     {
         $this->inline = false;
 
@@ -55,7 +55,7 @@ class Radio extends Presenter
     /**
      * @return array
      */
-    public function variables() : array
+    public function variables(): array
     {
         $this->prepare();
 

+ 5 - 5
src/Grid/Filter/Presenter/Select.php

@@ -78,7 +78,7 @@ class Select extends Presenter
      *
      * @return array
      */
-    protected function buildOptions() : array
+    protected function buildOptions(): array
     {
         if (is_string($this->options)) {
             $this->loadRemoteOptions($this->options);
@@ -262,7 +262,7 @@ JS;
     /**
      * @return array
      */
-    public function variables() : array
+    public function variables(): array
     {
         return [
             'options'   => $this->buildOptions(),
@@ -274,7 +274,7 @@ JS;
     /**
      * @return string
      */
-    protected function elementClass() : string
+    protected function elementClass(): string
     {
         return $this->elementClass ?:
             ($this->elementClass = $this->getClass($this->filter->column()));
@@ -290,7 +290,7 @@ JS;
      *
      * @return $this
      */
-    public function load($target, $resourceUrl, $idField = 'id', $textField = 'text') : self
+    public function load($target, $resourceUrl, $idField = 'id', $textField = 'text'): self
     {
         $class = $this->elementClass();
 
@@ -324,7 +324,7 @@ JS;
      *
      * @return mixed
      */
-    protected function getClass($target) : string
+    protected function getClass($target): string
     {
         return str_replace('.', '_', $target);
     }

+ 1 - 1
src/Grid/Filter/Presenter/SelectResource.php

@@ -171,7 +171,7 @@ class SelectResource extends Presenter
     /**
      * @return array
      */
-    public function variables() : array
+    public function variables(): array
     {
         $this->value = request(
             $this->filter->column(),

+ 1 - 1
src/Grid/Filter/Presenter/Text.php

@@ -36,7 +36,7 @@ class Text extends Presenter
      *
      * @return array
      */
-    public function variables() : array
+    public function variables(): array
     {
         return [
             'placeholder' => $this->placeholder,

+ 1 - 1
src/Models/Administrator.php

@@ -63,7 +63,7 @@ class Administrator extends Model implements AuthenticatableContract
      *
      * @return BelongsToMany
      */
-    public function roles() : BelongsToMany
+    public function roles(): BelongsToMany
     {
         $pivotTable = config('admin.database.role_users_table');
 

+ 7 - 7
src/Models/HasPermissions.php

@@ -15,7 +15,7 @@ trait HasPermissions
      *
      * @return mixed
      */
-    public function allPermissions() : Collection
+    public function allPermissions(): Collection
     {
         if ($this->allPermissions) {
             return $this->allPermissions;
@@ -35,7 +35,7 @@ trait HasPermissions
      *
      * @return bool
      */
-    public function can($ability) : bool
+    public function can($ability): bool
     {
         if (! $ability) {
             return false;
@@ -60,7 +60,7 @@ trait HasPermissions
      *
      * @return bool
      */
-    public function cannot(string $permission) : bool
+    public function cannot(string $permission): bool
     {
         return ! $this->can($permission);
     }
@@ -70,7 +70,7 @@ trait HasPermissions
      *
      * @return mixed
      */
-    public function isAdministrator() : bool
+    public function isAdministrator(): bool
     {
         return $this->isRole(Role::ADMINISTRATOR);
     }
@@ -82,7 +82,7 @@ trait HasPermissions
      *
      * @return mixed
      */
-    public function isRole(string $role) : bool
+    public function isRole(string $role): bool
     {
         /* @var Collection $roles */
         $roles = $this->roles;
@@ -98,7 +98,7 @@ trait HasPermissions
      *
      * @return mixed
      */
-    public function inRoles($roles = []) : bool
+    public function inRoles($roles = []): bool
     {
         /* @var Collection $all */
         $all = $this->roles;
@@ -116,7 +116,7 @@ trait HasPermissions
      *
      * @return bool
      */
-    public function visible($roles = []) : bool
+    public function visible($roles = []): bool
     {
         if (empty($roles)) {
             return false;

+ 1 - 1
src/Models/Menu.php

@@ -49,7 +49,7 @@ class Menu extends Model
      *
      * @return BelongsToMany
      */
-    public function roles() : BelongsToMany
+    public function roles(): BelongsToMany
     {
         $pivotTable = config('admin.database.role_menu_table');
 

+ 1 - 1
src/Models/OperationLog.php

@@ -42,7 +42,7 @@ class OperationLog extends Model
      *
      * @return BelongsTo
      */
-    public function user() : BelongsTo
+    public function user(): BelongsTo
     {
         return $this->belongsTo(Administrator::class);
     }

+ 3 - 3
src/Models/Permission.php

@@ -50,7 +50,7 @@ class Permission extends Model
      *
      * @return BelongsToMany
      */
-    public function roles() : BelongsToMany
+    public function roles(): BelongsToMany
     {
         $pivotTable = config('admin.database.role_permissions_table');
 
@@ -66,7 +66,7 @@ class Permission extends Model
      *
      * @return bool
      */
-    public function shouldPassThrough(Request $request) : bool
+    public function shouldPassThrough(Request $request): bool
     {
         if (! $this->http_path) {
             return false;
@@ -138,7 +138,7 @@ class Permission extends Model
      *
      * @return bool
      */
-    protected function matchRequest(array $match, Request $request) : bool
+    protected function matchRequest(array $match, Request $request): bool
     {
         if (! $path = trim($match['path'], '/')) {
             return false;

+ 4 - 4
src/Models/Role.php

@@ -35,7 +35,7 @@ class Role extends Model
      *
      * @return BelongsToMany
      */
-    public function administrators() : BelongsToMany
+    public function administrators(): BelongsToMany
     {
         $pivotTable = config('admin.database.role_users_table');
 
@@ -49,7 +49,7 @@ class Role extends Model
      *
      * @return BelongsToMany
      */
-    public function permissions() : BelongsToMany
+    public function permissions(): BelongsToMany
     {
         $pivotTable = config('admin.database.role_permissions_table');
 
@@ -65,7 +65,7 @@ class Role extends Model
      *
      * @return bool
      */
-    public function can(?string $permission) : bool
+    public function can(?string $permission): bool
     {
         return $this->permissions()->where('slug', $permission)->exists();
     }
@@ -77,7 +77,7 @@ class Role extends Model
      *
      * @return bool
      */
-    public function cannot(?string $permission) : bool
+    public function cannot(?string $permission): bool
     {
         return ! $this->can($permission);
     }