Action::make('Manage Traveler')
->record($this->ownerRecord)
->model(Traveler::class)
->fillForm(function ($record) {
return $this->ownerRecord->travelers()->get()->toArray();
})
->form(function () {
return [
MultiSelect::make('travelers')
->model(Trip::class)
->relationship('travelers', 'first_name')
->preload()
->options(
function () {
return Traveler::query()->where('client_id', $this->ownerRecord->client_id)->pluck('first_name', 'id');
}
)
->createOptionForm(function () {
return Traveler::getForm();
})
->required()
];
})
Action::make('Manage Traveler')
->record($this->ownerRecord)
->model(Traveler::class)
->fillForm(function ($record) {
return $this->ownerRecord->travelers()->get()->toArray();
})
->form(function () {
return [
MultiSelect::make('travelers')
->model(Trip::class)
->relationship('travelers', 'first_name')
->preload()
->options(
function () {
return Traveler::query()->where('client_id', $this->ownerRecord->client_id)->pluck('first_name', 'id');
}
)
->createOptionForm(function () {
return Traveler::getForm();
})
->required()
];
})