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