Database Notifications Slideover Custom Model

Hello,

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

I tried doing an override of 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();
    }
}


And then putting it in the AppServiceProvider:
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.
Was this page helpful?