Files
aibuddytool/app/View/Composers/CountryLocaleComposer.php

31 lines
715 B
PHP

<?php
namespace App\View\Composers;
use App\Models\CountryLocale;
use Illuminate\View\View;
class CountryLocaleComposer
{
public function compose(View $view)
{
$country_locales = CountryLocale::all();
$current_country_locale = null;
if (!is_null(request()->session()->get('view_country_locale')))
{
$current_country_locale = request()->session()->get('view_country_locale');
}
else
{
$current_country_locale = CountryLocale::where('slug', config('platform.general.fallback_country_slug'))->first();
}
$view->with('country_locales', $country_locales)
->with('current_country_locale', $current_country_locale);
}
}