AttachAction::make()
->recordSelectSearchColumns(['full_name', 'fan'])
->form(fn (AttachAction $action): array => [
$action->getRecordSelect()
->getOptionLabelsUsing(function ($value): string {
$student = Student::find($value);
return static::getCleanOptionString($student);
})
])
// In a relationship...
->modifyQueryUsing: function(Builder $query){ $query->where(cohort_id, cohort_id)}
->recordSelectOptionsQuery(fn (Builder $query) => $query-> whereBelongsTo(timeslot()->activity()->cohort)),
AttachAction::make()
->recordSelectSearchColumns(['full_name', 'fan'])
->form(fn (AttachAction $action): array => [
$action->getRecordSelect()
->getOptionLabelsUsing(function ($value): string {
$student = Student::find($value);
return static::getCleanOptionString($student);
})
])
// In a relationship...
->modifyQueryUsing: function(Builder $query){ $query->where(cohort_id, cohort_id)}
->recordSelectOptionsQuery(fn (Builder $query) => $query-> whereBelongsTo(timeslot()->activity()->cohort)),