2025-12-01 23:12:59 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
|
|
class UpdateProfileRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
|
*/
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
|
*
|
|
|
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
2026-02-03 14:01:49 +09:00
|
|
|
// 최고관리자만 이름 수정 가능
|
|
|
|
|
$nameRule = auth()->user()->isSuperAdmin()
|
|
|
|
|
? 'required|string|max:100'
|
|
|
|
|
: 'nullable';
|
|
|
|
|
|
2025-12-01 23:12:59 +09:00
|
|
|
return [
|
2026-02-03 14:01:49 +09:00
|
|
|
'name' => $nameRule,
|
2025-12-01 23:12:59 +09:00
|
|
|
'phone' => 'nullable|string|max:20',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get custom attributes for validator errors.
|
|
|
|
|
*
|
|
|
|
|
* @return array<string, string>
|
|
|
|
|
*/
|
|
|
|
|
public function attributes(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'name' => '이름',
|
|
|
|
|
'phone' => '연락처',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|