Gabriel Sieben
Explore posts from serversDatabase Notifications Slideover Custom Model
How can I invoke
@livewire('notifications')
and have it refer to NinjaWarrior
instead of User? I've done all the authentication myself, it should be as easy as @livewire('notifications', ['model' => auth()->ninjawarrior()]
, ideally... but that doesn't work. What would I do?45 replies
Database Notifications Slideover Custom Model
Perhaps... ugh. I wish...
OK, actually, here's probably the simplest way I can phrase my problem (sorry for any confusion): Imagine if I renamed the User model in my app to
NinjaWarrior
or something funny like that. How would I tell Filament to use my NinjaWarrior
model?45 replies
Database Notifications Slideover Custom Model
@awcodes Scrap the above then; here's another analogy that might make sense. Imagine if I have teams. I can be in multiple teams, and I can move between teams. There is such a thing as "team notifications" that I might want to send to a whole team. With the Filament panel, I the user could get notifications, but I couldn't display team notifications because the filament panel only shows User model notifications.
45 replies
Database Notifications Slideover Custom Model
That's the goal. Right now Filament has no idea, because everyone is the same User account and has the same username/password, that anything has changed even though my
Student::currentStudent()
or whatever is changing. Every student, and parent, gets the same notification panel.45 replies
Database Notifications Slideover Custom Model
Well, here's a quick sketch of what it's like.
It's a learning website, so the way it works is that the User creates an account and signs in. We have an authenticated User, we can see the User's notifications, no problem.
The User, on the home page, sees the option to either select a Student (and thus add a Student to their session), or browse for courses to purchase for a Student, or view grades for all their Students. It's not truly "logging in as" Student even though it very much looks like it, because all Students under that account have the same User. However, the Students should have seperate notifications than the User (because the User wants to get notified about "Payment Declined," that kind of thing, whereas Students should have seperate "Course starting in 10 minutes" warnings.)
The notification panel is in the header. Right now, any notifications sent to
App\Models\User
get displayed, no problem. I can send notifications to App\Models\Student
like you see in the table, but I can't tell @livewire('notifications')
to show that model instead. I wish I could do something like @livewire('notifications', ['model' => Student::currentStudent()]
or @livewire('notifications', ['model' => auth()->user()])
or similar.45 replies