ToggleUserRole
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- demote() : array{success: bool, error?: string}
- Demote a user from admin.
- promote() : array{success: bool, error?: string}
- Promote a user to admin.
Properties
$userRepository
private
MySqlUserRepository
$userRepository
Methods
__construct()
public
__construct(MySqlUserRepository $userRepository) : mixed
Parameters
- $userRepository : MySqlUserRepository
demote()
Demote a user from admin.
public
demote(int $userId, int $currentAdminId) : array{success: bool, error?: string}
Parameters
- $userId : int
-
The user to demote
- $currentAdminId : int
-
The admin performing the action
Return values
array{success: bool, error?: string}promote()
Promote a user to admin.
public
promote(int $userId, int $currentAdminId) : array{success: bool, error?: string}
Parameters
- $userId : int
-
The user to promote
- $currentAdminId : int
-
The admin performing the action