Example of Blade components in tighten/laravelversions

File app/View/Components/LanguageSelector.php (link to Github)
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Illuminate\View\Component;

class LanguageSelector extends Component
{
    public $current_language;
    public $formatted_languages;

    public function __construct()
    {
        $this->formatted_languages = collect(Config::get('localized-routes.supported-locales', []))->map(function ($lang) {
            return [
                'language_name' => $lang,
                'language_name_native' => Config::get("localized-routes.locales-name-native.{$lang}", Str::upper($lang)),
                'language_url' => Route::localizedUrl($lang),
            ];
        });

        $this->current_language = $this->formatted_languages->first(function ($languageObject) {
            return $languageObject['language_name'] === App::getLocale();
        })['language_name_native'];
    }

    public function render()
    {
        return view('components.language-selector');
    }
}
File resources/views/partials/modules/header.blade.php (link to Github)
@if (Config::has('localized-routes.supported-locales'))
        <x-language-selector />
@endif

Additional resources on blade components: