X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/934a833818b77e51f83d21a22478aea36ae9a294..refs/pull/3918/head:/app/Auth/Permissions/RolePermission.php diff --git a/app/Auth/Permissions/RolePermission.php b/app/Auth/Permissions/RolePermission.php index 0a0e6ff17..f34de917c 100644 --- a/app/Auth/Permissions/RolePermission.php +++ b/app/Auth/Permissions/RolePermission.php @@ -4,6 +4,7 @@ namespace BookStack\Auth\Permissions; use BookStack\Auth\Role; use BookStack\Model; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; /** * @property int $id @@ -13,19 +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(); }