© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
44 replies
Gabriel Sieben

Database Notifications Slideover Custom Model

Hello,

I love the
@livewire('notifications')
@livewire('notifications')
panel, and have almost everything working correctly... but how do I use a Model (with the
Notifiable
Notifiable
trait on it, of course) that isn't
User
User
?

I tried doing an override of
Filament\Livewire\DatabaseNotifications
Filament\Livewire\DatabaseNotifications
like so:

<?php

declare(strict_types=1);

namespace App\Livewire;

use Filament\Facades\Filament;
use Filament\Livewire\DatabaseNotifications as OriginalDatabaseNotifications;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;

class DatabaseNotifications extends OriginalDatabaseNotifications
{
    public function getUser(): Model | Authenticatable | null
    {
        return Team::myCurrentTeam() ?? Filament::auth()->user();
    }
}
<?php

declare(strict_types=1);

namespace App\Livewire;

use Filament\Facades\Filament;
use Filament\Livewire\DatabaseNotifications as OriginalDatabaseNotifications;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;

class DatabaseNotifications extends OriginalDatabaseNotifications
{
    public function getUser(): Model | Authenticatable | null
    {
        return Team::myCurrentTeam() ?? Filament::auth()->user();
    }
}


And then putting it in the AppServiceProvider:
use App\Livewire\DatabaseNotifications;
public function boot(): void
{
  DatabaseNotifications::trigger('components/unread-notifications-button');
}
use App\Livewire\DatabaseNotifications;
public function boot(): void
{
  DatabaseNotifications::trigger('components/unread-notifications-button');
}



But no luck; the slideover panel is still showing for the logged-in User instead of my other Notifiable entity.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Database notifications for a custom model
FilamentFFilament / ❓┊help
3y ago
Custom Database Notification Model
FilamentFFilament / ❓┊help
2y ago
Database notifications
FilamentFFilament / ❓┊help
2y ago
Database notifications toast
FilamentFFilament / ❓┊help
3mo ago