public function compose(View $view)
    {
        $enabledLangs = $this->config->get('langs');

        $langs = array_map(function ($lang) use ($enabledLangs) {
            $locale = basename($lang);

            return [$locale => Arr::get($enabledLangs, $locale, [
                'name'   => $locale,
                'subset' => null,
            ])];
        }, glob(base_path('resources/lang').'/*'));

        $langs = call_user_func_array('array_merge', $langs);

        $regions = [
            'UTC'        => DateTimeZone::UTC,
            'Africa'     => DateTimeZone::AFRICA,
            'America'    => DateTimeZone::AMERICA,
            'Antarctica' => DateTimeZone::ANTARCTICA,
            'Arctic'     => DateTimeZone::ARCTIC,
            'Asia'       => DateTimeZone::ASIA,
            'Atlantic'   => DateTimeZone::ATLANTIC,
            'Australia'  => DateTimeZone::AUSTRALIA,
            'Europe'     => DateTimeZone::EUROPE,
            'Indian'     => DateTimeZone::INDIAN,
            'Pacific'    => DateTimeZone::PACIFIC,
        ];

        $timezones = [];

        foreach ($regions as $name => $mask) {
            $zones = DateTimeZone::listIdentifiers($mask);

            foreach ($zones as $timezone) {
                // Lets sample the time there right now
                $time = new DateTime(null, new DateTimeZone($timezone));

                if ($timezone !== 'UTC') {
                    // Remove region name and add a sample time
                    $timezones[$name][$timezone] = substr($timezone, strlen($name) + 1).' - '.$time->format('H:i');
                } else {
                    $timezones[$name][$timezone] = 'UTC - '.$time->format('H:i');
                }

                $timezones[$name] = str_replace('_', ' ', $timezones[$name]);
            }
        }

        $view->withTimezones($timezones);
        $view->withLangs($langs);
    }
public function compose(View $view)
    {
        $enabledLangs = $this->config->get('langs');

        $langs = array_map(function ($lang) use ($enabledLangs) {
            $locale = basename($lang);

            return [$locale => Arr::get($enabledLangs, $locale, [
                'name'   => $locale,
                'subset' => null,
            ])];
        }, glob(base_path('resources/lang').'/*'));

        $langs = call_user_func_array('array_merge', $langs);

        $regions = [
            'UTC'        => DateTimeZone::UTC,
            'Africa'     => DateTimeZone::AFRICA,
            'America'    => DateTimeZone::AMERICA,
            'Antarctica' => DateTimeZone::ANTARCTICA,
            'Arctic'     => DateTimeZone::ARCTIC,
            'Asia'       => DateTimeZone::ASIA,
            'Atlantic'   => DateTimeZone::ATLANTIC,
            'Australia'  => DateTimeZone::AUSTRALIA,
            'Europe'     => DateTimeZone::EUROPE,
            'Indian'     => DateTimeZone::INDIAN,
            'Pacific'    => DateTimeZone::PACIFIC,
        ];

        $timezones = [];

        foreach ($regions as $name => $mask) {
            $zones = DateTimeZone::listIdentifiers($mask);

            foreach ($zones as $timezone) {
                // Lets sample the time there right now
                $time = new DateTime(null, new DateTimeZone($timezone));

                if ($timezone !== 'UTC') {
                    // Remove region name and add a sample time
                    $timezones[$name][$timezone] = substr($timezone, strlen($name) + 1).' - '.$time->format('H:i');
                } else {
                    $timezones[$name][$timezone] = 'UTC - '.$time->format('H:i');
                }

                $timezones[$name] = str_replace('_', ' ', $timezones[$name]);
            }
        }

        $view->withTimezones($timezones);
        $view->withLangs($langs);
    }
public function compose ( View $ view ) { $ enabledLangs = $ this -> config -> get ( 'langs' ) ; $ langs = array_map ( function ( $ lang ) use ( $ enabledLangs ) { $ locale = basename ( $ lang ) ; return [ $ locale => Arr :: get ( $ enabledLangs , $ locale , [ 'name' => $ locale , 'subset' => null , ] ) ] ; } , glob ( base_path ( 'resources/lang' ) . '/*' ) ) ; $ langs = call_user_func_array ( 'array_merge' , $ langs ) ; $ regions = [ 'UTC' => DateTimeZone :: UTC , 'Africa' => DateTimeZone :: AFRICA , 'America' => DateTimeZone :: AMERICA , 'Antarctica' => DateTimeZone :: ANTARCTICA , 'Arctic' => DateTimeZone :: ARCTIC , 'Asia' => DateTimeZone :: ASIA , 'Atlantic' => DateTimeZone :: ATLANTIC , 'Australia' => DateTimeZone :: AUSTRALIA , 'Europe' => DateTimeZone :: EUROPE , 'Indian' => DateTimeZone :: INDIAN , 'Pacific' => DateTimeZone :: PACIFIC , ] ; $ timezones = [ ] ; foreach ( $ regions as $ name => $ mask ) { $ zones = DateTimeZone :: listIdentifiers ( $ mask ) ; foreach ( $ zones as $ timezone ) { // Lets sample the time there right now $ time = new DateTime ( null , new DateTimeZone ( $ timezone ) ) ; if ( $ timezone !== 'UTC' ) { // Remove region name and add a sample time $ timezones [ $ name ] [ $ timezone ] = substr ( $ timezone , strlen ( $ name ) + 1 ) . ' - ' . $ time -> format ( 'H:i' ) ; } else { $ timezones [ $ name ] [ $ timezone ] = 'UTC - ' . $ time -> format ( 'H:i' ) ; } $ timezones [ $ name ] = str_replace ( '_' , ' ' , $ timezones [ $ name ] ) ; } } $ view -> withTimezones ( $ timezones ) ; $ view -> withLangs ( $ langs ) ; }
Timezones and Locales composer.

@param \Illuminate\Contracts\View\View $view

@return void
Timezones and Locales composer .