Files
aibuddytool/app/View/Composers/CountryLocaleComposer.php
Charles T 36efe23dcc Add (routes): All routes possible
Add (pages): home country page
2023-07-26 03:10:36 +08:00

32 lines
707 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'));
}
$view->with('country_locales', $country_locales)
->with('current_country_locale', $current_country_locale);
}
}