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>
|
<nav>
|
||||||
<i class="fa fa-hamburger"></i>
|
<i class="fa fa-hamburger"></i>
|
||||||
<div>
|
<div>
|
||||||
|
@auth
|
||||||
|
<a href="{{ url("user") }}"> Hello {{ Auth::user()->name }} </a>
|
||||||
|
@endauth
|
||||||
|
@guest
|
||||||
<a href="{{ route("login") }}">Login</a>
|
<a href="{{ route("login") }}">Login</a>
|
||||||
|
@endguest
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<main>
|
<main>
|
||||||
|
|
|
@ -31,6 +31,4 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@endsection()
|
@endsection()
|
||||||
|
|
|
@ -25,7 +25,7 @@ Route::get('/', [MainPageController::class, "index"])->name("main");
|
||||||
Route::get('/user', function () {
|
Route::get('/user', function () {
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
return view("user", ["user"=>$user]);
|
return view("user", ["user"=>$user]);
|
||||||
})->middleware("auth");
|
})->middleware("auth")->name("user");
|
||||||
|
|
||||||
Route::view("/login", "login");
|
Route::view("/login", "login");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue