How to load assets for Notifications
Hi! I'm stuck on implementing the Notifications. Compiling the files with Vite a .js and .css file is correctly created in
public/build/assets
. The problem seems to be Filament not looking (or finding) the blade template in resources/views/layouts/app.blade.php
.
For example, when adding a console.log()
to resources/js/app.js
and compiling with Vite. This log is not shown when loading the admin panel. What am I doing wrong? Thanks in advance!13 Replies
Update:
Running
npm run dev
seems to work fine and the following is shown in the console while running:
Update:
I also tried adding the @livewire('notifications')
to the blade template of a custom page. But this does not make any difference. The main issue seems to be loading the JS file somewhere.
I'm registering the theme with:
Tried the following:
The file seems to be found, but the following error is shown:
[Error] TypeError: undefined is not an object (evaluating '$store.sidebar.isOpen')
Where are you trying to do this? The panel has notifications built in
I used this documentation to setup the notifications: https://filamentphp.com/docs/2.x/notifications/installation
Filament
Installation - Notifications - Filament
Elegant TALL stack notifications for Laravel artisans.
But can't figure it out to work, my JS looks as folllows:
And then in a random resource page:
Again: What are you trying to do?!
The Admin Panel already has notifications!
I'm trying to show a notification to the user
Alright, but how does it work? As this doesn't show anything:
Where are you using this?
Random resource page:Which part of it?
I tried different locations. At this point at the
submit()
of a custom page (with HasForms):
Do you use the
<x-filament::page>
layout in your blade?Yes I do
Hm, should work then, I guess. The submit method gets called?
Yes, I also tried a
dd()
, that is shown fine at the same point in code
Do you maybe have any advice on how to approach the debugging?<x-filament::page>
is for admin panel pages...
if you're in the admin panel, you dont need to set up notifications
as dennis said
your original question also mentions the admin panel
check what the content of the session is after you send()