Patrick Boivin
Patrick Boivin
FFilament
Created by Patrick Boivin on 9/22/2023 in #❓┊help
Testing infolist actions
Hey @hasnayeen
14 replies
FFilament
Created by Patrick Boivin on 9/14/2023 in #❓┊help
Using protected properties on form actions
Is it safe to store a protected property on a form action?
class MyFormAction extends Action
{
protected bool $myOption = false;

protected function setUp(): void
{
parent::setUp();

$this->label('My Action')
->action(function () {
if ($this->myOption) {
// ...
} else {
// ...
}
});
}

public function myOption(bool $myOption = true): static
{
$this->myOption = $myOption;

return $this;
}
}
class MyFormAction extends Action
{
protected bool $myOption = false;

protected function setUp(): void
{
parent::setUp();

$this->label('My Action')
->action(function () {
if ($this->myOption) {
// ...
} else {
// ...
}
});
}

public function myOption(bool $myOption = true): static
{
$this->myOption = $myOption;

return $this;
}
}
13 replies
FFilament
Created by Patrick Boivin on 7/16/2023 in #❓┊help
Possible bug with Builder field and FileUpload
I've been chasing a bug I thought was in my project and I just want to confirm that I'm not losing my mind 😅 Here's a simplified example:
Builder::make('test')->blocks([
Block::make('file')->schema([
FileUpload::make('file'),
])
]),
Builder::make('test')->blocks([
Block::make('file')->schema([
FileUpload::make('file'),
])
]),
1. Start on an empty form 2. Add a block, leave it empty 3. Delete the block 4. See the following error in the Browser console:
module.esm.js:23899 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
...
module.esm.js:23899 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
...
9 replies
FFilament
Created by Patrick Boivin on 5/8/2023 in #❓┊help
Update form field from page action
Hi all, I feel like this is relatively simple Livewire stuff but I can't figure it out. I'm trying to dynamically update a field from a page action in my EditRecord class, I've tried a few different things without any luck :
class EditProduct extends EditRecord
{
// ...

public function calculatePrice()
{
$this->price_retail = 123.45;

$this->data['price_retail'] = 123.45;

$this->form->evaluate(fn (Closure $set) => $set('price_retail', 123.45));
}
}
class EditProduct extends EditRecord
{
// ...

public function calculatePrice()
{
$this->price_retail = 123.45;

$this->data['price_retail'] = 123.45;

$this->form->evaluate(fn (Closure $set) => $set('price_retail', 123.45));
}
}
Am I getting warmer?
11 replies
FFilament
Created by Patrick Boivin on 3/23/2023 in #❓┊help
Filament table driven by JSON data
4 replies