F
Filament5mo ago
Pan

Change relation manager to instead creating a new record, select from an existing record to attach.

I have a UserResource with a relation manager for equipment. However instead of creating a new record "New Equipment" at the edit page of User, I want it to actually be where it simply updates the selected Equipment user_id to what user I am currently at the edit page of. As of now I only have this at the EquipmentsRelationmanager.php wherein it only shows Options that doesn't have a user_id already in
Forms\Components\Select::make('name')
->label('Equipment')
->options([Equipment::whereNull('user_id')->pluck('name')
]),
Forms\Components\Select::make('name')
->label('Equipment')
->options([Equipment::whereNull('user_id')->pluck('name')
]),
this leads to simply creation of a new record. I am a beginner, hoping a clear explanation and guidance for my level. Thank you!
1 Reply
Solution