2016-04-24 15:54:20 +00:00
|
|
|
<?php namespace BookStack;
|
2015-08-29 14:03:42 +00:00
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class Permission extends Model
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The roles that belong to the permission.
|
|
|
|
*/
|
|
|
|
public function roles()
|
|
|
|
{
|
2016-04-09 11:37:58 +00:00
|
|
|
return $this->belongsToMany('BookStack\Role');
|
2015-08-29 14:03:42 +00:00
|
|
|
}
|
2016-02-27 19:24:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the permission object by name.
|
2016-04-24 15:54:20 +00:00
|
|
|
* @param $name
|
2016-02-27 19:24:42 +00:00
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public static function getByName($name)
|
|
|
|
{
|
|
|
|
return static::where('name', '=', $name)->first();
|
|
|
|
}
|
2015-08-29 14:03:42 +00:00
|
|
|
}
|