. * @author ruhllatio * @copyright 2015 nZEDb */ namespace nntmux\utility; use App\Models\Country as CountryModel; /** * Class Country. */ class Country { /** * Get a country code for a country name. * * @param string $country * * * @return mixed */ public static function countryCode($country) { if (! is_array($country) && strlen($country) > 2) { $code = CountryModel::query()->where('country', $country)->first(['id']); if (isset($code['id'])) { return $code['id']; } } return ''; } }