Display current user in header

This commit is contained in:
bad 2021-11-26 11:23:50 +01:00
parent adf94ac2a1
commit f736882f5e
3 changed files with 7 additions and 4 deletions

View file

@ -12,7 +12,12 @@
<nav>
<i class="fa fa-hamburger"></i>
<div>
<a href="{{ route("login") }}">Login</a>
@auth
<a href="{{ url("user") }}"> Hello {{ Auth::user()->name }} </a>
@endauth
@guest
<a href="{{ route("login") }}">Login</a>
@endguest
</div>
</nav>
<main>

View file

@ -31,6 +31,4 @@
</form>
</div>
</div>
</body>
</html>
@endsection()

View file

@ -25,7 +25,7 @@ Route::get('/', [MainPageController::class, "index"])->name("main");
Route::get('/user', function () {
$user = Auth::user();
return view("user", ["user"=>$user]);
})->middleware("auth");
})->middleware("auth")->name("user");
Route::view("/login", "login");