- Translated UI elements to Indonesian for better localization. - Improved layout by introducing Card components for better visual structure. - Removed unnecessary imports and props related to passkeys and two-factor authentication. - Updated tests to cover new password update scenarios and validation rules. - Ensured proper redirection and error handling for unauthorized access to security settings. - Enhanced user experience by adding success flash messages on password updates.
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Settings;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class ProfileUpdateRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
$userId = $this->user()->id;
|
|
|
|
return [
|
|
'email' => [
|
|
'required',
|
|
'string',
|
|
'email',
|
|
'max:255',
|
|
Rule::unique('users', 'email')->ignore($userId),
|
|
],
|
|
'username' => [
|
|
'required',
|
|
'string',
|
|
'max:20',
|
|
'alpha_dash',
|
|
Rule::unique('users', 'username')->ignore($userId),
|
|
],
|
|
'full_name' => ['required', 'string', 'max:200'],
|
|
'phone_number' => ['nullable', 'string', 'max:20'],
|
|
'gender' => ['nullable', 'in:male,female'],
|
|
'birth_date' => ['nullable', 'date'],
|
|
'address' => ['nullable', 'string'],
|
|
];
|
|
}
|
|
}
|