Svet
Svet
FFilament
Created by Svet on 8/26/2024 in #❓┊help
Custom card component in a form
No description
3 replies
FFilament
Created by Svet on 7/24/2024 in #❓┊help
Update a form field when a notification is received from Edit page
Hey all, I'm trying to update a field in a Filament form when I receive a Laravel notification. I've setup the listeners and I'm receiving the notification fine, but I'm having trouble understanding how to actually update the field from the Edit page. I have very little experience with Filament and Livewire, but have been using Laravel for many years. Currently, I have the following:
// app/Filament/Resources/VideoResource/Pages/EditVideo.php

protected $listeners = [
'echo:videos,ScriptGenerated' => 'updateScript',
];

public function updateScript(): void
{
$this->form->fill([
'script' => $this->record->script,
]);
}
// app/Filament/Resources/VideoResource/Pages/EditVideo.php

protected $listeners = [
'echo:videos,ScriptGenerated' => 'updateScript',
];

public function updateScript(): void
{
$this->form->fill([
'script' => $this->record->script,
]);
}
This kinda works, but it also overwrites all the other fields in the form, which is not what I want. I'm not exactly sure what to ask here, because I'm not entirely certain if what I'm doing is wrong or not. I see there is a $this->form->getLivewire() method and I can change the properties directly from there, but I'm certain this isn't how it's supposed to be done heh. I read the Livewire and Filament documentation on events and notifications, but this is where I got stuck. Google and chatgpt were of no help.
Any help appreciated!
7 replies