Iztok
Iztok
FFilament
Created by Iztok on 2/22/2024 in #❓┊help
Edit action in getHeaderActions
I used to be able to simply do this on Resource view page (or any other Resource page):
protected function getHeaderActions(): array
{
return [
ViewAction::make(),
EditAction::make(),
DeleteAction::make()
];
}
protected function getHeaderActions(): array
{
return [
ViewAction::make(),
EditAction::make(),
DeleteAction::make()
];
}
But after the update the edit link opens an empty modal, so I have to specify the url like this:
{
return [
ViewAction::make(),
EditAction::make()
->url(fn ($record): string => PhantomInstanceResource::getUrl('edit', ['record' => $record])),
DeleteAction::make()
];
}
{
return [
ViewAction::make(),
EditAction::make()
->url(fn ($record): string => PhantomInstanceResource::getUrl('edit', ['record' => $record])),
DeleteAction::make()
];
}
Is there any way to define the default edit action in the resource definition?
2 replies
FFilament
Created by Iztok on 11/6/2023 in #❓┊help
Using Laravel-data casting
We are using spatie/laravel-data (https://spatie.be/docs/laravel-data) and if used as a eloquent cast on a model, the behavior that is normal in a array eloquent cast, is not available. For example: TextColumn::make('data.name') would not work if "data" column was casted as a data object extending Spatie\LaravelData\Data. Anyone solved this and what would be the best way to approach this?
1 replies
FFilament
Created by Iztok on 10/11/2023 in #❓┊help
Form issues dynamically loadin static functions from a class that return an array of form components
I'm dynamically loading form compnents into schema(). The fields are displayed properly but are not operational (validation, default, saving - all not working). When I load the static function from the class manually in code, everything is working as expected.
Forms\Components\Fieldset::make('input_settings')
->label(__('Settings'))
->statePath('settings')
->visible(function (Get $get, Component $component) {
if ($get('type')) {
return true;
} else {
return false;
}
})
->schema(function (Get $get, Component $component) {
// this works fine
return \App\Services\Workflows\InputTypes\FilesUpload::settingsForm() ?? [];

// this only display the form, but doesn't save the data (even default values don't work)
if ($type = $get('type')) {
$types = InputTypes::list();
$type_class = $types[$type];
//dd($type_class); // returns "App\Services\Workflows\InputTypes\FilesUpload"
$form = $type_class::settingsForm();
} else {
$form = [];
}

return $form;
})
Forms\Components\Fieldset::make('input_settings')
->label(__('Settings'))
->statePath('settings')
->visible(function (Get $get, Component $component) {
if ($get('type')) {
return true;
} else {
return false;
}
})
->schema(function (Get $get, Component $component) {
// this works fine
return \App\Services\Workflows\InputTypes\FilesUpload::settingsForm() ?? [];

// this only display the form, but doesn't save the data (even default values don't work)
if ($type = $get('type')) {
$types = InputTypes::list();
$type_class = $types[$type];
//dd($type_class); // returns "App\Services\Workflows\InputTypes\FilesUpload"
$form = $type_class::settingsForm();
} else {
$form = [];
}

return $form;
})
2 replies
FFilament
Created by Iztok on 9/25/2023 in #❓┊help
Form polling
I have a background task with a queued job based on which a form element would be enabled/disabled. So until the job is done, the form element should be disabled. How should I go about this without having togo too much outside of Filament forms (I say this because I have an idea ho would I do this with a custom Livewire component).
3 replies
FFilament
Created by Iztok on 9/20/2023 in #❓┊help
How to alter the resource ('s edit form) if the resource is defined in a package/plugin?
I'm using a plugin that defines a filament resource. I need to extend the resource form by adding a field. I've managed to alter the source model to add a new fillable entry, but now I need to add a new field to a form.
2 replies
FFilament
Created by Iztok on 6/27/2023 in #❓┊help
Page with table, query URL
I changed a ViewRecord page to a show a table, which works fine, but when applying filters or sorting, the URL does not update. What would be a way to force URL query to change on this page?
8 replies
FFilament
Created by Iztok on 6/6/2023 in #❓┊help
SQL error on table bulk action when originally sorting by relationship count
Hello, when using sorting by relationship count: Tables\Columns\TextColumn::make('people_count')->counts('people')->label('People')->sortable(), and then executing a table BulkAction, the SQL that Filament executes to get the records to work with is the following (example of me selecting 3 companies from the table): select * from companies where companies.id in (53, 80, 1, 12) order by people_count desc This query is not valid, as there is not column "people_count".
3 replies
FFilament
Created by Iztok on 4/7/2023 in #❓┊help
Error during upload - no errors in logs, works with smaller files (PHP and Nginx limits lifted)
I'm using Filament Forms FileUpload component and it's returning "Error during upload" for files above 10M. Problem is, that my log files are not showing anything. All limits (PHP and Nginx) are lifted.
3 replies