HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers85/equichecker.com/app/KommaApp/Core/Facades/Komma.php
<?php

/**
 * Short description for the file.
 *
 * @author      Tim Van Samang <timvansamang@komma.pro>
 * @copyright   (c) 2012-2015, Komma Mediadesign
 */

namespace KommaApp\Core\Facades;

use KommaApp\Countries\Models\Country;
use KommaApp\Languages\Models\Language;
use KommaApp\Sites\Models\Site;

class Komma
{

    public static $site;
    public static $language;


    static function setSite(Site $site = null)
    {
        if (!$site) return false;
        Self::$site = $site;
    }


    static function setLocale($lang)
    {

        if (is_int($lang)) $lang = Language::find($lang);
        else if (is_string($lang)) $lang = Language::where('iso_2', '=', $lang)->first();

        \App::setlocale($lang->iso_2);

        Self::$language = $lang;
        //Set the language based on the locale

    }

    static function setDefaultLocale()
    {
        self::setLocale(\Config::get('app.locale'));
    }

    static function getCountryIso($country_id){
        if($country_id == null) return null;

        if(!$country = Country::find($country_id)) return null;

        return $country->iso_2;


    }

}