aldec
aldec
FFilament
Created by aldec on 1/30/2025 in #❓┊help
Accessing relationship data in form lifecycle hook
>hidden(fn(Get $get) => $get('trafficRegulationOrder.traffic_regulation') !== 'beigefügtem Regelplan') works, layout wise I have to rethink my initial plan
15 replies
FFilament
Created by aldec on 1/30/2025 in #❓┊help
Accessing relationship data in form lifecycle hook
Ah I have to reference the relationship in the hidden() method as well
15 replies
FFilament
Created by aldec on 1/30/2025 in #❓┊help
Accessing relationship data in form lifecycle hook
Moving it outside of the relationship group seems to break the hidden() conditional
15 replies
FFilament
Created by aldec on 1/30/2025 in #❓┊help
Accessing relationship data in form lifecycle hook
Here is the form part I'm working on:
Group::make()
->relationship('trafficRegulationOrder')
->schema([
Grid::make()->schema([
Select::make('traffic_regulation')
->options(app(RoadworksSettings::class)->getOptionsArray('selection_traffic_regulation'))
->live()
FileUpload::make('upload_traffic_regulation')
->hidden(fn(Get $get) => $get('traffic_regulation') !== 'beigefügtem individuellen Schilderplan')
->preserveFilenames()
->directory('documents')
->downloadable()
->openable()
->previewable()
->label('Individuellen Schilderplan hochladen'),
Select::make('rsa21')
->options(app(RoadworksSettings::class)->getOptionsArray('selection_rsa21'))
->hidden(fn(Get $get) => $get('traffic_regulation') !== 'beigefügtem Regelplan')
]),
Group::make()
->relationship('trafficRegulationOrder')
->schema([
Grid::make()->schema([
Select::make('traffic_regulation')
->options(app(RoadworksSettings::class)->getOptionsArray('selection_traffic_regulation'))
->live()
FileUpload::make('upload_traffic_regulation')
->hidden(fn(Get $get) => $get('traffic_regulation') !== 'beigefügtem individuellen Schilderplan')
->preserveFilenames()
->directory('documents')
->downloadable()
->openable()
->previewable()
->label('Individuellen Schilderplan hochladen'),
Select::make('rsa21')
->options(app(RoadworksSettings::class)->getOptionsArray('selection_rsa21'))
->hidden(fn(Get $get) => $get('traffic_regulation') !== 'beigefügtem Regelplan')
]),
There is a dropdown in the left part of the grid and dependent on the selected option I have a second select on the right or this File Upload
15 replies
FFilament
Created by aldec on 1/30/2025 in #❓┊help
Accessing relationship data in form lifecycle hook
Basically, yes. If I place it outside the relationship, I should be able to access it via $data.
15 replies
FFilament
Created by aldec on 1/30/2025 in #❓┊help
Accessing relationship data in form lifecycle hook
Perhaps my approach is not right overall. I have a hasMany relationship and would like to enable the upload of a file via a Document model (of which the main model can have several in total) in a form. Since I would like to have the field where it is now (in the relationship group) and relationship() does not support hasMany anyway, my idea was to put the upload field there, but remove it before saving and create the content manually in the Document model and then saving the main model with the rest of the fields. But right now I can't seem to access the form fields data of the relationship
15 replies
FFilament
Created by aldec on 1/30/2025 in #❓┊help
Accessing relationship data in form lifecycle hook
Mh... the mutateDataBeforeCreate and handleRecordCreation only take $data as argument. Do you mean accessing the form field's data through an entire different method?
15 replies
FFilament
Created by aldec on 11/14/2024 in #❓┊help
Combine Relationship Manager tabs and form tabs
Hey, I'm coming back to this, feeling stupid that I didn't notice it earlier: 1. It is still necessary to load the RelationManager in the resources getRelations method, otherwise I can't create new entries (symfony error not finding the component), but then I have it under each form visible again... bummer. 2. Having this Livewire component in my tabs seems to hijack the form submit process, because nothing happens if i try to edit a form where this Livewire
13 replies
FFilament
Created by aldec on 11/14/2024 in #❓┊help
Combine Relationship Manager tabs and form tabs
Awesome! Thank you very much! This has the additional benefit of not having a page reload like the hasCombinedRelationManagerTabsWithContent method has
13 replies
FFilament
Created by aldec on 11/14/2024 in #❓┊help
Combine Relationship Manager tabs and form tabs
YourModel in the RelationManager refers to target model. For my use case right now this should work, but a more reusable solution would be nice. Thanks so far!
13 replies
FFilament
Created by aldec on 11/14/2024 in #❓┊help
Combine Relationship Manager tabs and form tabs
No description
13 replies
FFilament
Created by aldec on 11/14/2024 in #❓┊help
Combine Relationship Manager tabs and form tabs
No description
13 replies