isMethod('POST'); $rules = [ 'unit_id' => 'sometimes|required|integer|exists:units,id', 'name' => 'sometimes|required|string|max:255', 'social_name' => 'sometimes|nullable|string|max:255', 'role' => 'sometimes|nullable|string|max:100', 'cpf' => 'sometimes|required|string|max:20', 'rg' => 'sometimes|nullable|string|max:30', 'birth_date' => 'sometimes|nullable|date', 'participation' => 'sometimes|nullable|numeric|min:0|max:100', 'email' => 'sometimes|nullable|email|max:255', 'secondary_email' => 'sometimes|nullable|email|max:255', 'phone_number' => 'sometimes|nullable|string|max:20', 'cell_number' => 'sometimes|nullable|string|max:20', 'postal_code' => 'sometimes|nullable|string|max:9', 'street' => 'sometimes|nullable|string|max:255', 'address_number' => 'sometimes|nullable|string|max:20', 'neighborhood' => 'sometimes|nullable|string|max:255', 'complement' => 'sometimes|nullable|string|max:255', 'city_id' => 'sometimes|nullable|integer|exists:cities,id', 'state_id' => 'sometimes|nullable|integer|exists:states,id', 'avatar' => 'sometimes|nullable|image|max:2048', ]; if ($isCreate) { $rules['unit_id'] = 'required|integer|exists:units,id'; $rules['name'] = 'required|string|max:255'; $rules['cpf'] = 'required|string|max:20'; } return $rules; } }