select box
This commit is contained in:
@@ -19,5 +19,5 @@ interface UserServiceInterface
|
||||
|
||||
public function getRankingList(string $type, string $selectedMonth, User $currentUser): array;
|
||||
|
||||
public function updateProfile(User $user, ?\Illuminate\Http\UploadedFile $avatarFile, ?string $newPassword): void;
|
||||
public function updateProfile(User $user, array $data, ?\Illuminate\Http\UploadedFile $avatarFile = null): void;
|
||||
}
|
||||
@@ -214,15 +214,19 @@ class UserService implements UserServiceInterface
|
||||
];
|
||||
}
|
||||
|
||||
public function updateProfile(User $user, ?\Illuminate\Http\UploadedFile $avatarFile, ?string $newPassword): void
|
||||
public function updateProfile(User $user, array $data, ?\Illuminate\Http\UploadedFile $avatarFile = null): void
|
||||
{
|
||||
if (isset($data['name'])) {
|
||||
$user->name = $data['name'];
|
||||
}
|
||||
|
||||
if ($avatarFile) {
|
||||
$path = $avatarFile->store('avatars', 'public');
|
||||
$user->avatar = 'storage/' . $path;
|
||||
}
|
||||
|
||||
if ($newPassword) {
|
||||
$user->pass = md5($newPassword);
|
||||
if (!empty($data['new_password'])) {
|
||||
$user->pass = md5($data['new_password']);
|
||||
$user->first_login = config('constants.FIRST_LOGIN_FALSE');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user