UpdateMeRequest.php 769 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Illuminate\Support\Facades\Auth;
  5. use Illuminate\Validation\Rule;
  6. class UpdateMeRequest extends FormRequest
  7. {
  8. public function authorize(): bool
  9. {
  10. return true;
  11. }
  12. public function rules(): array
  13. {
  14. return [
  15. 'name' => 'sometimes|string|nullable|max:255',
  16. 'email' => ['sometimes', 'email', 'nullable', Rule::unique('users', 'email')->ignore(Auth::id())],
  17. 'phone' => 'sometimes|string|nullable',
  18. 'language' => 'sometimes|string|nullable',
  19. 'document' => 'sometimes|string|nullable',
  20. 'avatar' => 'sometimes|file|image|mimes:jpg,jpeg,png,webp|max:5120',
  21. ];
  22. }
  23. }