Something went wrong. Try again.
Store your seeds
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940<?php
declare(strict_types=1);
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\ValidationRule;use Illuminate\Foundation\Http\FormRequest;use Illuminate\Validation\Rule;use Illuminate\Validation\Rules\Password;
class UpdateUserRequest 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, ValidationRule|array<mixed>|string> */ public function rules(): array { // Get the user model instance from the route $user = $this->route('user');
return [ 'name' => ['string', 'max:50'], 'email' => ['nullable', 'string', 'email', Rule::unique('users', 'email')->ignore($user->id)], 'password' => ['nullable', 'string', Password::default()], 'currentPassword' => ['nullable', 'required_with:password', 'string', Password::default()], ]; }}