1 | <?php |
||||||||
2 | |||||||||
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||||||||
3 | namespace BristolSU\Module\AssignRoles\Http\Controllers\ParticipantApi; |
||||||||
4 | |||||||||
5 | use BristolSU\ControlDB\Contracts\Models\Role; |
||||||||
6 | use BristolSU\ControlDB\Contracts\Models\User; |
||||||||
7 | use BristolSU\ControlDB\Contracts\Repositories\Pivots\UserRole; |
||||||||
8 | use BristolSU\Module\AssignRoles\Events\UserAssigned; |
||||||||
9 | use BristolSU\Module\AssignRoles\Http\Controllers\Controller; |
||||||||
10 | use BristolSU\Module\AssignRoles\Http\Requests\ParticipantApi\AssignController\DestroyRequest; |
||||||||
11 | use BristolSU\Module\AssignRoles\Http\Requests\ParticipantApi\AssignController\UpdateRequest; |
||||||||
12 | use BristolSU\Support\Activity\Activity; |
||||||||
13 | use BristolSU\Support\Authentication\Contracts\Authentication; |
||||||||
14 | use BristolSU\Support\ModuleInstance\ModuleInstance; |
||||||||
15 | |||||||||
16 | class AssignController extends Controller |
||||||||
0 ignored issues
–
show
|
|||||||||
17 | { |
||||||||
18 | |||||||||
19 | 3 | public function update(Activity $activity, ModuleInstance $moduleInstance, int $roleId, int $userId, UpdateRequest $request, UserRole $userRole) |
|||||||
0 ignored issues
–
show
The parameter
$request is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
Loading history...
The parameter
$activity is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
Loading history...
The parameter
$moduleInstance is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
Loading history...
|
|||||||||
20 | { |
||||||||
21 | 3 | $this->authorize('assign'); |
|||||||
22 | |||||||||
23 | 2 | $userRole->addUserToRole( |
|||||||
24 | 2 | $user = app(\BristolSU\ControlDB\Contracts\Repositories\User::class)->getById($userId), |
|||||||
25 | 2 | $role = app(\BristolSU\ControlDB\Contracts\Repositories\Role::class)->getById($roleId) |
|||||||
26 | ); |
||||||||
27 | |||||||||
28 | 2 | event(new UserAssigned($user, $role)); |
|||||||
29 | |||||||||
30 | 2 | } |
|||||||
31 | |||||||||
32 | 3 | public function destroy(Activity $activity, ModuleInstance $moduleInstance, int $roleId, int $userId, DestroyRequest $request, UserRole $userRole) |
|||||||
0 ignored issues
–
show
The parameter
$moduleInstance is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
Loading history...
The parameter
$activity is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
Loading history...
The parameter
$request is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
Loading history...
|
|||||||||
33 | { |
||||||||
34 | 3 | $this->authorize('unassign'); |
|||||||
35 | |||||||||
36 | 2 | $userRole->removeUserFromRole( |
|||||||
37 | 2 | app(\BristolSU\ControlDB\Contracts\Repositories\User::class)->getById($userId), |
|||||||
38 | 2 | app(\BristolSU\ControlDB\Contracts\Repositories\Role::class)->getById($roleId) |
|||||||
39 | ); |
||||||||
40 | 2 | } |
|||||||
41 | |||||||||
42 | |||||||||
43 | |||||||||
44 | } |