Skip to content

Commit

Permalink
Fix notifications and messages in the navigation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Raccoon254 committed May 29, 2024
1 parent e65e7d4 commit 511a955
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions app/Livewire/Navbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@

namespace App\Livewire;

use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
use Livewire\Component;

class Navbar extends Component
{
public function render()
public $hasNotifications = false;
public $hasMessages = false;

public function mount(): void
{
$user = Auth::user();
if ($user) {
$this->hasMessages = $user->hasUnreadMessages ?? false;
//TODO: Add hasUnreadNotifications attribute to the User model
$this->hasNotifications = $user->hasUnreadNotifications ?? false;
}
}

public function render(): View
{
return view('livewire.navbar');
return view('layouts.navigation');
}
}
2 changes: 1 addition & 1 deletion resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</head>
<body class="font-sans antialiased">
<div class="min-h-screen bg-white">
@include('layouts.navigation')
<livewire:navbar />
<div class="flex relative gap-2 p-2">
@include('layouts.sidebar')
<!-- Page Content -->
Expand Down

0 comments on commit 511a955

Please sign in to comment.