I'm completely new to Laravel, MVC and templating engines in general.
I need to show certain navbar buttons and options if a user is logged in such as: Notifications, Logout, Profile, etc... and a Login button otherwise.
Any help on how I could address this the right way is greatly appreciated. This is what I'm considering at the moment:
- A
User
object is always passed to the view. - The view checks if the
User
is set (meaning it's logged in) to include the appropriate partial blade template for the navbar.
app.blade.php:
...
@if (isset($user))
@include('partials.navbarlogged')
@else
@include('partials.navbar')
...
Is this the best method? Thanks for your time!
@guest ... @endguest
– Screen