Files
productalert/app/View/Composers/CountryLocaleComposer.php
Charles T ded1643e5f Add (post manage)
Add (post country viewing)
2023-07-28 02:29:11 +08:00

27 lines
717 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);
}
}