vacation-planner/app/Http/Requests/Settings/ProfileUpdateRequest.php
2026-11-28 12:59:18 +08:00

34 lines
839 B
PHP
Executable File

<?php
namespace App\Http\Requests\Settings;
use App\Concerns\ProfileValidationRules;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
class ProfileUpdateRequest extends FormRequest
{
use ProfileValidationRules;
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
if (config('fortify.lowercase_usernames') && is_string($this->input('email'))) {
$this->merge(['email' => Str::lower($this->input('email'))]);
}
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return $this->profileRules($this->user()->id);
}
}