@foreach($languages as $language)
@if ($language->lang_code != $currentLanguage->lang_code)
{!! language_flag($language->lang_flag, $language->lang_name) !!}
@if (array_key_exists($language->lang_code, $related))
{{ $language->lang_name }}
@else
@php
$currentQueryString = BaseHelper::removeQueryStringVars(Request::getQueryString(), ['ref_from', 'ref_lang']);
$queryString = '';
if (!Str::contains($currentQueryString, 'ref_from=')) {
$queryString = 'ref_from=' . (!empty($args[0]) && $args[0]->id ? $args[0]->id : 0) . '&';
}
$queryString .= 'ref_lang=' . $language->lang_code;
if (!empty($currentQueryString)) {
$queryString = $currentQueryString . '&' . $queryString;
}
@endphp
{{ $language->lang_name }}
@endif
@endif
@endforeach