format) { 'alpha2' => $query->where('alpha2', $code), 'alpha3' => $query->where('alpha3', $code), 'numeric' => $query->where('numeric', str_pad($code, 3, '0', STR_PAD_LEFT)), 'any' => $query->forIsoCode($code), default => $query->whereRaw('1 = 0'), }; if ($this->activeOnly) { $query->where('is_active', true); } if (! $query->exists()) { $fail('The :attribute must be a supported ISO 3166 country code.'); } } }