yokana
yokana

Reputation: 309

how to show nav-item when opening special view laravel

how to show navbar only when i opening special view. example i have create this is app.blade.php

@guest
<li class="nav-item">
  <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
</li>
 @if (Route::has('register'))
  <li class="nav-item">
   <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
  </li>
 @endif
@Post
    <div><a href="/p/create">post New</a></div>
@endPost    
@else
@endguest

i want to showing those navbar only if i opening post.blade.php ini my view

Upvotes: 1

Views: 188

Answers (1)

Md Abdul Awal
Md Abdul Awal

Reputation: 522

Get the route name whois to load post.blade.php this view and then checked if the current route Route::currentRouteName(); match your routes.

//Example
@if('load_view_route_name' == Route::currentRouteName())
   //Your Nav or Other elements
@endif

Upvotes: 1

Related Questions