]> BookStack Code Mirror - bookstack/blobdiff - app/Auth/Permissions/RolePermission.php
Skip intermediate login page with single provider
[bookstack] / app / Auth / Permissions / RolePermission.php
index 7f44ff8152b5a23b759b5fce3a83238da01855f9..f34de917c07a425e7bf689c728d2edbe8ed2bfab 100644 (file)
@@ -1,7 +1,10 @@
-<?php namespace BookStack\Auth\Permissions;
+<?php
+
+namespace BookStack\Auth\Permissions;
 
 use BookStack\Auth\Role;
 use BookStack\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
 
 /**
  * @property int $id
@@ -11,17 +14,15 @@ class RolePermission extends Model
     /**
      * The roles that belong to the permission.
      */
-    public function roles()
+    public function roles(): BelongsToMany
     {
         return $this->belongsToMany(Role::class, 'permission_role', 'permission_id', 'role_id');
     }
 
     /**
      * Get the permission object by name.
-     * @param $name
-     * @return mixed
      */
-    public static function getByName($name)
+    public static function getByName(string $name): ?RolePermission
     {
         return static::where('name', '=', $name)->first();
     }