Relationship
How can I customize the creation process of a relation manager? I'm trying to implement this https://github.com/filamentphp/filament/discussions/1514 But the methods (handleRecordCreation, mutateFormDataBeforeFill and handleRecordUpdate) are no longer fired!
GitHub
Translatable popup Relation managers Β· filamentphp filament Β· Discu...
Hello, I am working on solution, how to edit translatable fields in popup relation managers. I made a trait, that emit event, when you switch language on resource page. This trait is used in Edit p...
18 Replies
I guess i need to change it on the action
but that makes it so i no longer can use 1 single trait
which is kinda frustrating
You can use one custom action instead?!
yeah but then i basicly have to recode the whole thing
becouse you don't have access to a bunch of things
For example i think the owner record was not set yet in mutateRecordDataUsing
which is a pain, becouse you can't access the language in that case i think
Not sure what's the isse sorry. Why do you need to re-code everything? What's the difference to using the mutate methods on the Action?
For example i think the owner record was not set yet in mutateRecordDataUsingShould be
fn ($livewire) => $livewire->ownerRecord
not recode everything, but it's also deffintly not a copy and paste
let me check
gives this error: https://flareapp.io/share/q5YNBqxm
Flare
Typed property Filament\Resources\RelationManagers\RelationManager::$ownerRecord must not be accessed before initialization - The error occurred at http://localhost:8000/admin/boats/173
Well, it's a different component that works differently, so it definitely needs some adjustments
Not sure where you found
$manager
but it must be $livewire
as in my example.that works indeed, nice!
not sure tbh π
I think my ide suggested it
You cannot simply change var names, that Filament uses to inject data.
What you did created a fresh, blank RM instance. Not the one you expected
ahh
do you have any clue how i would get the current selected locale?
the old way doesn't work anymore for some reason
not really sure why
No sorry. Never worked with Translatable stuff π
there is a lot of magic happening
and i can't find out where π
so i looked at the code
and the language selector is just a selectaction
does this emit any events i would be ale to listen to?
livewire will allow you to hook into the
update
of that propertydo you know what property that is, and how i can hook into that?
most important is the first thing, second one i can propably figure out on my own
its the property with the same name of the action
check the underlying code, its a simple wire:model
i'm relativly new to such complex livewire
and with complex i mean a lot of classes/traits and whatnot
to be honest its very simple livewire once you understand that the only livewire component is the page
I figured it out!
I created two new actions
I'm wondering how to translate the table tough
edit and create works, now the only thing left is the table
does anyone have a clue how i would be able to do this maybe?
maybe change the base query to only collect the selected language? π€