tg
tg
FFilament
Created by Noxo on 8/6/2024 in #❓┊help
The huge form is too slow
@Noxo Which version of spatie/laravel-data do you use? ::from usually triggers validation for all fields, which might slow things down considerably. Regular new instantiation should skip validation and be orders of magnitude faster as you observed. If you use v4, you may want to try out the Dto class: https://spatie.be/docs/laravel-data/v4/as-a-data-transfer-object/creating-a-data-object#content-dto-classes I guess you can skip validation when you are building the form from existing database-driven field definitions, as these have been validated at creation/update.
19 replies
FFilament
Created by DMB on 2/27/2024 in #❓┊help
ToggleColumns bug?
I have the same issue, currently using v3.2.63. Just to make clear what the issue is: 1. Define a Table with a Split layout component for a resource which has an Edit page 2. add a ToggleColumn 3. Navigate to that table, click the toggle column: the toggled value is changed, but it also opens the edit page for that resource. This behavior does not occur when: a) The resource does not have an edit page: The edit modal does not open on toggle column clicks b) The table definition explicitly disables the default recordUrl to the edit page ping @Dan Harrin @Dennis Koch I'll check if I can find the cause, likely a click handler conflict
3 replies
FFilament
Created by tg on 4/2/2024 in #❓┊help
Modal action or table inside form
In essence, I want to put a relation manager (i.e. table of related resources) inside its parent resource form. Overriding hasCombinedRelationManagerTabsWithContent render relation managers below the resource form, but not inside – presumably because of the nested forms. This is a purely visual requirement. But I found a solution while digging through the Select component code! A ->model() call to the form component action on a ViewField does the trick. This requires some additional setup for the actions, but I can probably refactor that into a custom field.
Forms\Components\ViewField::make('notes')
->hintAction(
CreateNoteInFormAction::make()
)
->view('filament.resources.notes-list')
->registerActions([
Action::make('editNote')
->label('bearbeiten')
->link()
->form(fn($form) => NoteResource::form($form)->model(Note::class))
->fillForm(fn(Action $action, $arguments) => Note::find($arguments['note'])->toArray())
->action(static function (array $arguments, array $data) {
Note::find($arguments['note'])->update($data);
}),
])
Forms\Components\ViewField::make('notes')
->hintAction(
CreateNoteInFormAction::make()
)
->view('filament.resources.notes-list')
->registerActions([
Action::make('editNote')
->label('bearbeiten')
->link()
->form(fn($form) => NoteResource::form($form)->model(Note::class))
->fillForm(fn(Action $action, $arguments) => Note::find($arguments['note'])->toArray())
->action(static function (array $arguments, array $data) {
Note::find($arguments['note'])->update($data);
}),
])
The CreateNoteInFormAction is a custom action class that does some setup. Nonetheless, tables inside forms would be nice to have, but I understand the difficulties 🙂 Thanks @Dan Harrin !
15 replies
FFilament
Created by tg on 4/2/2024 in #❓┊help
Modal action or table inside form
Unfortunately, the edit form should edit one of the related records of the currently editing record, so $record doesn't help if it is the parent record. My model relationship: Company -morphMany-> Notes In the screenshot of my EditCompany page, the “bearbeiten” link action should edit the selected row's note: https://cdn.discordapp.com/attachments/1224815288160354324/1224815288382656612/image.png?ex=661edd20&is=660c6820&hm=43ee2a4d2c5a842f27e271142a5c0e6d7a9c675eee5271376e289ad3b041b14d& (middle column, light gray – I complained fruitlessly to the designer about the lack of contrast) This is why I'd like to use a table, as it comes with all of this included 😄 But breaks because of nested forms.
15 replies
FFilament
Created by tg on 4/2/2024 in #❓┊help
Modal action or table inside form
That I know, but I don't know how to feed the existing related model into the form component action's form. I'll dig into the editOption code of the Select component to see how it's done.
15 replies
FFilament
Created by tg on 4/2/2024 in #❓┊help
Modal action or table inside form
That might be an option, will check. Thanks! Just in case it got lost in my wall of text above: Form component actions are not usable for resource edit operations, or am I missing something? I'd suspect it should work like the Select component editOption modal, but can't get it to.
15 replies
FFilament
Created by tg on 4/2/2024 in #❓┊help
Modal action or table inside form
@Dan Harrin Thanks for the insight! Bummer but reasonable. @awcodes Would be an option to have them on the same page, but the design guidelines of this project demand a three-column form with a listing inside.
15 replies
FFilament
Created by tg on 4/2/2024 in #❓┊help
Modal action or table inside form
- Is there a way to render a table or at least modal actions within custom Livewire components, without introducing nested form elements? registerActions on a ViewField seems to work, but I don't know if/how I can use them to edit a related model. - If that's currently impossible, can someone from the core team share their insights why the @teleport investigation at [6] was dropped as “not planned”? @Dan Harrin teased this as a potential Filament v3 feature in [7], but probably had good reasons to drop it. 1: https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component 2: https://www.answeroverflow.com/m/1138201866354835536 3: https://discord.com/channels/883083792112300104/1191881756987633856/1191881756987633856 4: https://github.com/filamentphp/filament/discussions/11845 5: https://github.com/filamentphp/filament/blob/3.x/packages/actions/resources/views/components/modals.blade.php 6: https://github.com/filamentphp/filament/discussions/3654 7: https://github.com/filamentphp/filament/discussions/3654#discussioncomment-3720002
15 replies
FFilament
Created by richeklein on 4/24/2023 in #❓┊help
Managing custom properties with Spatie Media Library plugin
I have the same requirement as SLy: I have a Media Library field allowing multiple uploads to a PDF collection, and I need to manage each file's type metadata which is stored in a custom property. I've experimented with a Repeater field as described by @Mansoor Khan in https://discord.com/channels/883083792112300104/1158821463168659496/1158822746457919498, but this would require overriding a lot of the callbacks of SpatieMediaLibraryFileUpload as they expect a Model implementing HasMedia instead of a single Media model. Is there a convenient way that I missed, or is a custom field the way to go?
14 replies