roombroom
roombroom
FFilament
Created by roombroom on 8/15/2023 in #❓┊help
Using echo listeners
Hello, is it possible to listen for events using Echo as described here: https://laravel-livewire.com/docs/2.x/laravel-echo ? I can't seem to get it to work. I have the following in my "Page" (/App/Filament/Resources/ResourceName/Pages/Page.php)
public $showNewOrderNotification = false;

// Special Syntax: ['echo:{channel},{event}' => '{method}']
protected $listeners = ['echo:orders,OrderShipped' => 'notifyNewOrder'];

public function notifyNewOrder()
{
$this->showNewOrderNotification = true;
}
public $showNewOrderNotification = false;

// Special Syntax: ['echo:{channel},{event}' => '{method}']
protected $listeners = ['echo:orders,OrderShipped' => 'notifyNewOrder'];

public function notifyNewOrder()
{
$this->showNewOrderNotification = true;
}
I can see that my event is being triggered in my Ably account, but I don't see that Filament is adding any code that would subscribe the browser to the "orders" channel. Am I missing something or is this not supported?
3 replies
FFilament
Created by roombroom on 6/27/2023 in #❓┊help
Debounce / Lazy on Markdown Field not working
I've created a markdown field with the following settings:
Forms\Components\Markdown::make('question')
->default('Question?')
->reactive()
->lazy()
->afterStateupdated(function ($state) {
Debugbar::log($state);
}),
Forms\Components\Markdown::make('question')
->default('Question?')
->reactive()
->lazy()
->afterStateupdated(function ($state) {
Debugbar::log($state);
}),
The lazy() option does not appear to have any effect and causes the field to become basically unusable since it updates constantly while you're typing. However, if I switch this field to be a standard TextArea field like this:
Forms\Components\Textarea::make('question')
->default('Question?')
->reactive()
->lazy()
->afterStateupdated(function ($state) {
Debugbar::log($state);
}),
Forms\Components\Textarea::make('question')
->default('Question?')
->reactive()
->lazy()
->afterStateupdated(function ($state) {
Debugbar::log($state);
}),
The lazy() option works as expected and the field isn't updated until the field loses focus.
3 replies
FFilament
Created by roombroom on 6/25/2023 in #❓┊help
Unique selections on relationship repeater
I am using a repeater to create BelongsToMany relationships between two models. I would like to ensure the relationship to only exists once. Is there an easy way to accomplish this through the form builder?
4 replies