route('household'); $headUserId = $household?->head_user_id; return [ 'address_line' => ['required', 'string', 'max:255'], 'lat' => ['required', 'numeric', 'between:-90,90'], 'lng' => ['required', 'numeric', 'between:-180,180'], 'barangay_id' => ['required', 'integer', 'exists:barangays,id'], 'household_size' => ['required', 'integer', 'min:1', 'max:50'], 'head_user_id' => ['nullable', 'integer', 'exists:users,id'], // Head resident profile details 'first_name' => ['nullable', 'string', 'max:100'], 'last_name' => ['nullable', 'string', 'max:100'], 'email' => [ 'nullable', 'email', 'max:255', $headUserId ? 'unique:users,email,' . $headUserId : 'unique:users,email', ], 'phone' => [ 'nullable', 'string', 'max:20', $headUserId ? 'unique:users,phone,' . $headUserId : 'unique:users,phone', ], 'password' => ['nullable', 'string', 'min:8'], 'proof' => ['nullable', 'file', 'mimes:jpg,jpeg,png,pdf', 'max:8192'], ]; } }