F
Filament13mo ago
Omar

FormBuilder Select get event Editing

how i can get the event editing in the select input?
Forms\Components\Select::make('equipment_option_id')
->options(function($livewire){
$record_id = $livewire->ownerRecord->id;
$options = EquipmentOption::whereDoesntHave('equipments', function ($query) use ($record_id) {
$query->where('equipment_id', $record_id);
})->get();
if("Here i can get the event?"){

}
if ($options) {
return $options->pluck('name', 'id')->toArray();
}
})
->required(),
Forms\Components\Select::make('equipment_option_id')
->options(function($livewire){
$record_id = $livewire->ownerRecord->id;
$options = EquipmentOption::whereDoesntHave('equipments', function ($query) use ($record_id) {
$query->where('equipment_id', $record_id);
})->get();
if("Here i can get the event?"){

}
if ($options) {
return $options->pluck('name', 'id')->toArray();
}
})
->required(),
3 Replies
Saade
Saade13mo ago
what is an event?
Omar
OmarOP13mo ago
I need to obtain as the event when a resource is being edited or created, since the return of the options would be different
Saade
Saade13mo ago
you need to know if creating or editing? if yes, use $operation
Want results from more Discord servers?
Add your server