'sometimes|email', 'phone' => 'sometimes|string|nullable|max:20', 'name' => 'required|string|max:255', 'code' => 'required|string|max:6', 'document' => ['required', 'string', 'max:20'], 'rg' => 'required|string|max:20', 'birth_date' => 'required|date|before:today', 'zip_code' => 'required|string|max:20', 'address' => 'required|string|max:255', 'has_complement' => 'sometimes|boolean', 'complement' => 'nullable|string|max:255', 'nickname' => 'nullable|string|max:255', 'instructions' => 'nullable|string', 'address_type' => ['required', Rule::in(['home', 'commercial', 'other'])], 'city' => 'nullable|string|max:255', 'state' => 'nullable|string|max:2', 'daily_price_8h' => 'required|numeric|min:100|max:500', 'daily_price_6h' => 'required|numeric|min:0', 'daily_price_4h' => 'required|numeric|min:0', 'daily_price_2h' => 'required|numeric|min:0', 'services_types_ids' => 'sometimes|array', 'services_types_ids.*' => [ 'integer', Rule::exists('service_types', 'id')->where(function ($query) { $query->whereNull('deleted_at')->where('is_active', true); }), ], 'service_types_ids' => 'sometimes|array', 'service_types_ids.*' => [ 'integer', Rule::exists('service_types', 'id')->where(function ($query) { $query->whereNull('deleted_at')->where('is_active', true); }), ], 'working_days' => 'required|array|min:1', 'working_days.*.day' => 'required|integer|min:0|max:6', 'working_days.*.period' => ['required', Rule::in([WorkingPeriodEnum::MORNING->value, WorkingPeriodEnum::AFTERNOON->value])], 'selfie_base64' => 'required|string', 'document_front_base64' => 'required|string', 'document_back_base64' => 'required|string', 'is_approved' => 'sometimes|boolean', ]; if (!$this->has('email')) { $rules['phone'] = 'required|string|max:20'; $rules['email'] = 'nullable'; } if (!$this->has('phone')) { $rules['email'] = 'required|email'; $rules['phone'] = 'nullable'; } return $rules; } }