BookStack/app/RolePermission.php

24 lines
483 B
PHP
Raw Normal View History

<?php namespace BookStack;
2015-08-29 10:03:42 -04:00
class RolePermission extends Model
2015-08-29 10:03:42 -04:00
{
/**
* The roles that belong to the permission.
*/
public function roles()
{
return $this->belongsToMany(Role::class, 'permission_role','permission_id', 'role_id');
2015-08-29 10:03:42 -04:00
}
/**
* Get the permission object by name.
* @param $name
* @return mixed
*/
public static function getByName($name)
{
return static::where('name', '=', $name)->first();
}
2015-08-29 10:03:42 -04:00
}