]> BookStack Code Mirror - bookstack/blob - app/Auth/Permissions/RolePermission.php
Apply fixes from StyleCI
[bookstack] / app / Auth / Permissions / RolePermission.php
1 <?php
2
3 namespace BookStack\Auth\Permissions;
4
5 use BookStack\Auth\Role;
6 use BookStack\Model;
7
8 /**
9  * @property int $id
10  */
11 class RolePermission extends Model
12 {
13     /**
14      * The roles that belong to the permission.
15      */
16     public function roles()
17     {
18         return $this->belongsToMany(Role::class, 'permission_role', 'permission_id', 'role_id');
19     }
20
21     /**
22      * Get the permission object by name.
23      *
24      * @param $name
25      *
26      * @return mixed
27      */
28     public static function getByName($name)
29     {
30         return static::where('name', '=', $name)->first();
31     }
32 }