Select Relationship Modify Query Using
Hi everyone,
When I create an auction I select a car but the dropdown only shows the cars that don't belongs to another auction (I use modifyQueryUsing), so this works when I create.
The issue is when I try to update an auction, I cannot see my car selected in the dropdown list because that car already belongs to the same auction that I'm updating so how can I fix that?
6 Replies
Solved
relationship()
accepts more parameters one of which is modifyQueryUsing
. Maybe using it it's possible to achieve the same resultGitHub
filament/packages/forms/src/Components/Select.php at 3.x · filament...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
@Garrita use can check using $operation in
->modifyQueryUsing: fn (Builder $query, string $operation)
. It'll return the operation like create, edit, ... etc. You can modify according to that.I didn't know that we could inject those parameters in modifyQueryUsing omg, thanks!
you're welcome