| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App\Http\Requests;
- use Illuminate\Foundation\Http\FormRequest;
- class RegisterClientRequest extends FormRequest
- {
- protected function prepareForValidation(): void
- {
- if (! $this->filled('has_complement')) {
- $this->merge(['has_complement' => false]);
- }
- }
- public function rules(): array
- {
- return [
- 'email' => 'sometimes|email|nullable',
- 'phone' => 'required|string|max:20',
- 'name' => 'sometimes|string|max:255|nullable',
- 'code' => 'required|string|max:6',
- 'document' => 'required|string|max:20',
- 'zip_code' => 'sometimes|string|max:20|nullable',
- 'address' => 'sometimes|string|max:255|nullable',
- 'number' => 'required|string|max:20',
- 'district' => 'required|string|max:255',
- 'complement' => 'sometimes|string|max:255|nullable',
- 'has_complement' => 'required|boolean',
- 'nickname' => 'sometimes|string|max:255|nullable',
- 'instructions' => 'sometimes|string|max:500|nullable',
- 'address_type' => 'sometimes|string|in:home,commercial,other|nullable',
- 'city' => 'required|string|max:255',
- 'state' => 'required|string|max:10',
- 'latitude' => 'sometimes|numeric|nullable',
- 'longitude' => 'sometimes|numeric|nullable',
- 'avatar' => 'sometimes|nullable|file|image|mimes:jpg,jpeg,png,webp|max:5120',
- ];
- }
- }
|