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