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