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