public static function detect($site) { return (string) (int) $site == $site ? Site::getById((int) $site) : Site::find($site); }
protected function mapCountries() { foreach (static::CountryMapping as $index => $expected) { if (!$this->{$expected}) { $site = Site::getById($this->{static::SiteMapping[$index]}); if ($site instanceof Site) { $this->{static::CountryMapping[$index]} = $site->countryId; } } } }