/** * @return Role */ private function createAdminRole() { $owner = new Role(); $owner->name = 'system-administrator'; $owner->display_name = 'System Administrator'; $owner->description = 'The General admin user'; $owner->save(); return $owner; }
/** * Assing permissions to a Role * @param $roleId * @param $permissions * @return bool */ public function assignPermissionsToRole($roleId, $permissions) { $roles = Role::findOrFail($roleId); $roles->perms()->attach($permissions); return true; }