1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-24 03:42:32 +01:00

Fixed and cleaned some permisison/role based components

This commit is contained in:
Dan Brown 2016-04-09 12:37:58 +01:00
parent 66ba773367
commit 1a7de4c2d6
2 changed files with 10 additions and 1 deletions

View File

@ -11,7 +11,7 @@ class Permission extends Model
*/ */
public function roles() public function roles()
{ {
return $this->belongsToMany('BookStack\Permissions'); return $this->belongsToMany('BookStack\Role');
} }
/** /**

View File

@ -43,6 +43,15 @@ class Role extends Model
$this->permissions()->attach($permission->id); $this->permissions()->attach($permission->id);
} }
/**
* Detach a single permission from this role.
* @param Permission $permission
*/
public function detachPermission(Permission $permission)
{
$this->permissions()->detach($permission->id);
}
/** /**
* Get the role object for the specified role. * Get the role object for the specified role.
* @param $roleName * @param $roleName