]> BookStack Code Mirror - bookstack/blob - app/RolePermission.php
Fixes a corner case with exclamation in the ID.
[bookstack] / app / RolePermission.php
1 <?php namespace BookStack;
2
3 class RolePermission extends Model
4 {
5     /**
6      * The roles that belong to the permission.
7      */
8     public function roles()
9     {
10         return $this->belongsToMany(Role::class, 'permission_role', 'permission_id', 'role_id');
11     }
12
13     /**
14      * Get the permission object by name.
15      * @param $name
16      * @return mixed
17      */
18     public static function getByName($name)
19     {
20         return static::where('name', '=', $name)->first();
21     }
22 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.