UserService
final class UserService
Provides functions for managing users.
Methods
Deletes user if not admin and unlinks profile images if $unlink is set to true. Appropriate messaging is displayed based on success or failure.
Acts as safeguard to ensure incorrect user is not updated.
Uploads and sorts profile images.
Sends E-mail to user when account is deactivated as appropriate.
Sends E-mail to user when reset_password flag is set as appropriate.
Assist in toggling inactive field. Returns boolean value to determine if E-mail should be sent. To properly test if E-mail should be sent get value of $user->inactive before post.
Assist in toggling reset_password field.
Details
at line 27
static void
deleteIfAllowed(int $id, bool $unlink = false)
Deletes user if not admin and unlinks profile images if $unlink is set to true. Appropriate messaging is displayed based on success or failure.
at line 44
static array
deleteProfileImage(Input $request)
Deletes profile image
at line 60
static void
ensureAuthenticatedUser(Users $user)
Acts as safeguard to ensure incorrect user is not updated.
at line 77
static void
handleProfileImages(Users $user, Uploads|null $uploads, string|null $sortedImages)
Uploads and sorts profile images.
at line 94
static void
sendWhenSetToInactive(Users $user, bool $shouldSendEmail = false)
Sends E-mail to user when account is deactivated as appropriate.
at line 109
static void
sendWhenSetToResetPW(Users $user, bool $shouldSendEmail = false)
Sends E-mail to user when reset_password flag is set as appropriate.
at line 127
static bool
toggleAccountStatus(Users $user, Input $request, int|null $currentInactive = null)
Assist in toggling inactive field. Returns boolean value to determine if E-mail should be sent. To properly test if E-mail should be sent get value of $user->inactive before post.
at line 142
static bool
toggleResetPassword(Users $user, Input $request, int|null $currentReset = null)
Assist in toggling reset_password field.
at line 154
static Users|bool
updatePassword(Users $user, Input $request)
Updates user's password