<?php
/**
 * Created by PhpStorm.
 * User: jirislav
 * Date: 7.5.17
 * Time: 19:28
 */
?>
<ul class="nav navbar-nav navbar-right">
    <li>
        @php
            $containsQuestionMark = preg_match('/\\?/', URL::full());
            $containsLocale = preg_match('/locale=../', URL::full());
            $newUrl = URL::full() . ($containsQuestionMark ? '&' : '?') . 'locale=';
        @endphp
        <a href="{{ $newUrl . 'cs' }}"
           title="Čeština">
            <span class="flag-icon flag-icon-cz"></span>
        </a>
    </li>
    <li>
        <a href="{{ $newUrl . 'en' }}"
           title="English">
            <span class="flag-icon flag-icon-gb"></span>
        </a>
    </li>
</ul>
