Abdellah
Abdellah
FFilament
Created by Abdellah on 7/5/2024 in #❓┊help
Get the value of a field from a suffixAction
How can I get the value of a select field from a suffix action when the modal opens? I keep getting null when using $get
->schema([
Select::make('provider')
->options(
DatabaseProvider::getMysqlProviders(),
)
->live(),
])
->schema([
Select::make('provider')
->options(
DatabaseProvider::getMysqlProviders(),
)
->live(),
])
and I have another select
Select::make('cluster_id')
...
->suffixAction(
Action::make('cluster')
->form([
Select::make('size')
->options(function (Get $get) {
$provider = $get('credential') // this returns null
}
])
Select::make('cluster_id')
...
->suffixAction(
Action::make('cluster')
->form([
Select::make('size')
->options(function (Get $get) {
$provider = $get('credential') // this returns null
}
])
Thank you.
7 replies
FFilament
Created by Abdellah on 6/9/2024 in #❓┊help
Dispatch event in lifecycle hook
Hello, I want to dispatch an event in the lifecycle hook after creating a resource
class CreateMyResource extends CreateRecord
{
protected static string $resource = MyResource::class;

public function afterCreate(): void
{
...
Event::dispatch(new CreateADatabase($model['id'], $projectId, $branchId, $roleId, $databaseName));
}
}
class CreateMyResource extends CreateRecord
{
protected static string $resource = MyResource::class;

public function afterCreate(): void
{
...
Event::dispatch(new CreateADatabase($model['id'], $projectId, $branchId, $roleId, $databaseName));
}
}
My event is not firing. Is there any other way of firing the event? Thank you.
4 replies
FFilament
Created by Abdellah on 5/29/2024 in #❓┊help
Show a list of options based on another field
Hello devs, how can I show a list of options with Select based on another select element?
Select::make('choice')
->options(
[
'option-1' => 'Option 1',
'option-2' => 'Option 2',
]);
Select::make('choice')
->options(
[
'option-1' => 'Option 1',
'option-2' => 'Option 2',
]);
And I have another select field that should show different options that should still be saved in the choice field.
4 replies
FFilament
Created by Abdellah on 5/13/2024 in #❓┊help
Save a field when creating a model
Hello, I have a casts field in my model and I want to save two other fields into the particular field. This question is similar https://discord.com/channels/883083792112300104/1081223982960885771 but the provided solution does not work for me while using mutateFormDataBeforeCreate The field I want I can set it inside mutateFormDataBeforeCreate but it fails
SQLSTATE[HY000]: General error: 1364 Field 'myField' doesn't have a default value
SQLSTATE[HY000]: General error: 1364 Field 'myField' doesn't have a default value
. How can I save into this field on creation? Thank you.
5 replies
FFilament
Created by Abdellah on 5/9/2024 in #❓┊help
Inject an HttpClient into a Filament Page
Hello devs, so I have an HttpClient class that I have created and implemented some methods. I want to inject this in a Filament Page and consume the endpoints. How does this work please? Sorry if the question is generic.
4 replies