Ibe

If statement problem

Posted 9 months ago by Ibe

Hi there, can someone help me please with my elseif structure?

What I have:

@if (Route::has('login'))
              <div class="top-right links">
                  @if (Auth::guard('admin'))
                      <a href="{{ url('/admin') }}">Home</a>

                  @elseif (Auth::guard('user'))
                  <a href="{{ url('/home') }}">Home</a>

                  @else
                      <a href="{{ url('/login') }}">Login</a>
                      <a href="{{ url('/register') }}">Register</a>
                  @endif

              </div>
@endif 

So the only part that is not working is the last part:

@else
        <a href="{{ url('/login') }}">Login</a>
        <a href="{{ url('/register') }}">Register</a> 

So what I want is when nobody is logged in, I want to show these links. But I always get the 'home' links...

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.