loading_personality
loading_personality
FFilament
Created by loading_personality on 11/6/2024 in #❓┊help
Custom Field: Using Form Components
No description
7 replies
FFilament
Created by loading_personality on 11/6/2024 in #❓┊help
Custom Field: Using Form Components
i need to have a something like a form, and use a combination of filament form components. i've succeeded at making what i want, but i'm not sure if it's the right approach.
php

protected ?ComponentContainer $childComponentContainer = null;

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

public function getChildComponents(): array
{
if (!$this->childComponentContainer) {
$this->childComponentContainer = ComponentContainer::make($this->getLivewire())
->components($this->getFormSchema());
}

return $this->childComponentContainer->getComponents();
}

protected function getFormSchema(): array
{
return [
Select::make('type')
->options([
'option1' => 'Option 1',
'option2' => 'Option 2',
])
->live()
->required()
->afterStateUpdated(function () {
logger()->debug('iiiiii');
}),

TextInput::make('value')
->required()
->maxLength(255),
];
}
php

protected ?ComponentContainer $childComponentContainer = null;

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

public function getChildComponents(): array
{
if (!$this->childComponentContainer) {
$this->childComponentContainer = ComponentContainer::make($this->getLivewire())
->components($this->getFormSchema());
}

return $this->childComponentContainer->getComponents();
}

protected function getFormSchema(): array
{
return [
Select::make('type')
->options([
'option1' => 'Option 1',
'option2' => 'Option 2',
])
->live()
->required()
->afterStateUpdated(function () {
logger()->debug('iiiiii');
}),

TextInput::make('value')
->required()
->maxLength(255),
];
}
and in the field view:
<div>
@foreach($getChildComponents() as $component)
{{ $component->render() }}
@endforeach
</div>
<div>
@foreach($getChildComponents() as $component)
{{ $component->render() }}
@endforeach
</div>
7 replies
FFilament
Created by loading_personality on 10/27/2024 in #❓┊help
Help with dependable select
i think problem is with the first init, for instance if the first country that i select has no provinces, the fetch would never work. On the other hand if the first country that i select has provinces then the select would function as expected
3 replies
FFilament
Created by loading_personality on 3/3/2023 in #❓┊help
Table relationship eagerLoading
thank you for the answer, and sorry for uploading the screenshot, i've used telescope and found out that it eager loads automatiquely
3 replies