ProfileUpdateRequest.php 772 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Requests\Settings;
  3. use App\Models\User;
  4. use Illuminate\Contracts\Validation\ValidationRule;
  5. use Illuminate\Foundation\Http\FormRequest;
  6. use Illuminate\Validation\Rule;
  7. class ProfileUpdateRequest extends FormRequest
  8. {
  9. /**
  10. * Get the validation rules that apply to the request.
  11. *
  12. * @return array<string, ValidationRule|array<mixed>|string>
  13. */
  14. public function rules(): array
  15. {
  16. return [
  17. 'name' => ['required', 'string', 'max:255'],
  18. 'email' => [
  19. 'required',
  20. 'string',
  21. 'lowercase',
  22. 'email',
  23. 'max:255',
  24. Rule::unique(User::class)->ignore($this->user()->id),
  25. ],
  26. ];
  27. }
  28. }