store/app/Http/Requests/Admin/Account/UpdateProfileRequest.php
Yoga Pangestu d02af40836
Some checks failed
linter / quality (push) Waiting to run
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
feat: implement presigned upload functionality for S3 in PresignedUploadController; update media upload handling across various components to support S3 keys and improve user experience
2026-07-02 14:28:51 +07:00

53 lines
1.6 KiB
PHP

<?php
namespace App\Http\Requests\Admin\Account;
use App\Enums\Gender;
use App\Rules\PhoneNumber;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class UpdateProfileRequest extends FormRequest
{
public function authorize(): bool
{
return auth()->check();
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'email' => ['required', 'email', 'max:100', Rule::unique('users', 'email')->ignore($this->user()?->id)],
'username' => ['required', 'string', 'max:20', 'alpha_dash', Rule::unique('users', 'username')->ignore($this->user()?->id)],
'full_name' => ['required', 'string', 'max:200'],
'phone_number' => ['nullable', 'string', 'max:20', new PhoneNumber],
'gender' => ['nullable', Rule::enum(Gender::class)],
'birth_date' => ['nullable', 'date', 'before:today'],
'address' => ['nullable', 'string'],
'profile_s3_key' => ['nullable', 'string'],
'remove_profile_photo_ids' => ['nullable', 'array'],
'remove_profile_photo_ids.*' => ['integer'],
];
}
/**
* @return array<string, string>
*/
public function attributes(): array
{
return [
'email' => 'Email',
'username' => 'Username',
'full_name' => 'Nama Lengkap',
'phone_number' => 'Nomor Telepon',
'gender' => 'Jenis Kelamin',
'birth_date' => 'Tanggal Lahir',
'address' => 'Alamat',
'profile_s3_key' => 'Foto Profil',
];
}
}