src/Modules/Roles/Services/RoleService.php 1 location
|
@@ 28-38 (lines=11) @@
|
| 25 |
|
* @param array $permissionIds |
| 26 |
|
* @return object |
| 27 |
|
*/ |
| 28 |
|
public function assignPermissions($roleId, $permissionIds) |
| 29 |
|
{ |
| 30 |
|
$role = false; |
| 31 |
|
\DB::transaction(function () use ($roleId, $permissionIds, &$role) { |
| 32 |
|
$role = $this->repo->find($roleId); |
| 33 |
|
$this->repo->detachPermissions($roleId); |
| 34 |
|
$this->repo->attachPermissions($roleId, $permissionIds); |
| 35 |
|
}); |
| 36 |
|
|
| 37 |
|
return $role; |
| 38 |
|
} |
| 39 |
|
} |
| 40 |
|
|
src/Modules/Users/Services/UserService.php 1 location
|
@@ 130-140 (lines=11) @@
|
| 127 |
|
* @param array $roleIds |
| 128 |
|
* @return object |
| 129 |
|
*/ |
| 130 |
|
public function assignRoles($userId, $roleIds) |
| 131 |
|
{ |
| 132 |
|
$user = false; |
| 133 |
|
\DB::transaction(function () use ($userId, $roleIds, &$user) { |
| 134 |
|
$user = $this->repo->find($userId); |
| 135 |
|
$this->repo->detachPermissions($userId); |
| 136 |
|
$this->repo->attachPermissions($userId, $roleIds); |
| 137 |
|
}); |
| 138 |
|
|
| 139 |
|
return $user; |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* Handle the login request to the application. |