feat: 프로필 설정 페이지 추가

- 프로필 정보 수정 (이름, 전화번호)
- 비밀번호 변경 기능
- 헤더 드롭다운 메뉴 연결

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-01 23:12:59 +09:00
parent 273ac6caf6
commit d992a19735
7 changed files with 442 additions and 4 deletions

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Services;
use App\Models\User;
use Illuminate\Support\Facades\Hash;
class ProfileService
{
/**
* 프로필 정보 수정 (이름, 전화번호)
*/
public function updateProfile(User $user, array $data): bool
{
$user->name = $data['name'];
$user->phone = $data['phone'] ?? null;
$user->updated_by = $user->id;
return $user->save();
}
/**
* 비밀번호 변경
*/
public function changePassword(User $user, string $currentPassword, string $newPassword): array
{
// 현재 비밀번호 확인
if (! Hash::check($currentPassword, $user->password)) {
return [
'success' => false,
'message' => '현재 비밀번호가 일치하지 않습니다.',
];
}
// 새 비밀번호가 현재 비밀번호와 동일한지 확인
if (Hash::check($newPassword, $user->password)) {
return [
'success' => false,
'message' => '새 비밀번호는 현재 비밀번호와 다르게 설정해주세요.',
];
}
// 비밀번호 업데이트
$user->password = Hash::make($newPassword);
$user->updated_by = $user->id;
$user->save();
return [
'success' => true,
'message' => '비밀번호가 변경되었습니다.',
];
}
}