lundi 25 juillet 2016

Laravel Auth in error pages

When a user is logged into my application, there is a dropdown in the navigation to access administration. However, when a user stumbles across an error page (404, for instance) it doesn't show them being logged in. Instead it shows "Login". Why is this?

Here's my code.

@if (Auth::check())

    <ul class="nav navbar-nav navbar-right">
        <li class="dropdown">
            <a style="cursor: pointer;" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-user"></i>  <b class="caret"></b></a>
            <ul class="dropdown-menu">
                <li>
                    <a href="/admin/dashboard"><i class="glyphicon glyphicon-tasks"></i> Dashboard</a>
                </li>
                <li role="separator" class="divider"></li>
                <li><a href="/logout"><i class="glyphicon glyphicon-log-out"></i> Logout</a></li>
            </ul>
        </li>
    </ul>

@else

    <ul class="nav navbar-nav navbar-right">
        <li><a href="/login"><i class="glyphicon glyphicon-log-in"></i> Login</a</li>
    </ul>

@endif



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire