Display current user in header
This commit is contained in:
parent
adf94ac2a1
commit
f736882f5e
3 changed files with 7 additions and 4 deletions
|
@ -12,7 +12,12 @@
|
|||
<nav>
|
||||
<i class="fa fa-hamburger"></i>
|
||||
<div>
|
||||
@auth
|
||||
<a href="{{ url("user") }}"> Hello {{ Auth::user()->name }} </a>
|
||||
@endauth
|
||||
@guest
|
||||
<a href="{{ route("login") }}">Login</a>
|
||||
@endguest
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
||||
|
|
|
@ -31,6 +31,4 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@endsection()
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue