Brent Kelly
Brent Kelly
FFilament
Created by Matt Jenkins on 10/6/2023 in #❓┊help
Refresh a table when notification received
Nice solution @Matt Jenkins. If running on a Page you can call ->refresh() on the table to refresh it - which is a bit cleaner than having to hack the tableSearch. So this should work:
public function refreshTable()
{
$this->table->refresh();
}
public function refreshTable()
{
$this->table->refresh();
}
... although I do notice this won't work for a table in a widget so 🤷. In that case assigning tableSearch as you have works still so possibly better to stick with that. For anyone else reading this, you can also use the #[On] syntax if you don't need to inject variables into the channel name:
#[On('echo-private:fooChannel,BarEvent')]
public function refreshTable()
{
$this->tableSearch = $this->tableSearch;
}
#[On('echo-private:fooChannel,BarEvent')]
public function refreshTable()
{
$this->tableSearch = $this->tableSearch;
}
Finally - hopefully this point will help someone else. I have been using Model Broadcasting to broadcast, but couldn't for the life of me get Livewire (or even Echo directly) to respond to the broadcast event: 1. The event was broadcasting fine (appearing in Pusher debug console) 2. Filament/Livewire was connecting to the channel fine (appearing in the Push debug console) 3. Devtools was showing the websocket receiving the broadcast message fine ... however the event just would not fire. 🤔 I finally noticed I'd missed this: https://laravel.com/docs/11.x/broadcasting#listening-for-model-broadcasts If using Model Broadcasting you must prefix the event name with a .. So e.g. PostUpdated becomes .PostUpdated. Or it will fail silently.
5 replies
FFilament
Created by BlackShadow on 8/2/2023 in #❓┊help
Missing styling after upgrading to v3
I've also had styling issues but have resolved them so I'll share what I did on here in case it helps others. 1. I started on a ~3-4 week old version of the admin demo which have heavily modified. 2. Ran the automated upgrade. This was pretty good but missed a bunch of areas: - a number of method signatures I'd overridden were wrong - e.g. overridden getRelationManagers in resource pages. - once that was fixed, the styling wasn't working About 50% of the styling was missing - blue outlines on everything, no button styles etc. 1. I ran the artisan command suggested above here: php artisan filament:upgrade 2. Cleared view cache: php artisan view:clear 2. Tried to rebuild css with vite but npm run build was throwing errors:
Unable to resolve `@import "../../vendor/filament/filament/resources/css/app.css"` from /var/www/html/resources/css
Unable to resolve `@import "../../vendor/filament/filament/resources/css/app.css"` from /var/www/html/resources/css
From there the big help was just loading the demo source to compare vs my repo. I had to make the following changes: 1. My repo still had a resources/css/filament.css - delete this 2. My resources/css/app.css differed from the demo - namely it needed a: @import '../../vendor/filament/forms/dist/index.css'; at line 1. 3. My vite.config.js was wrong - attempting to load filament.css. I updated this and mirrored the refresh settings while I was at it from the demo. 4. Now I could run npm run build - ran successfully 5. 1 final error: my AppServiceProvider::boot method was registering filament.css still with Filament::registerViteTheme('resources/css/filament.css'); - I removed that Filament::serving section. Job done - loading fine & looks great 👌
8 replies