Select HasMany relationship with CreateOption

According to the docs the ability to create a new option on the fly only supports BelongsTo and BelongsToMany relations, but my use-case is a HasMany. I have been experimenting but nothing seems to work unfortunately. How can I get a HasMany to work? What I am trying to achieve is a checkout form where an authed user can select a shipping address, and if it does not exist they could create one on the fly.
Select::make('addresses')
->label(__('Shipping Address'))
->relationship(
name: 'auth.user.addresses', // Tried 'addresses`, 'user.addresses`, 'auth.user.addresses`,
titleAttribute: 'addres_line'
)
->preload()
->searchable(false)
->createOptionForm([
TextInput::make('line_one')
->required(),
])
Select::make('addresses')
->label(__('Shipping Address'))
->relationship(
name: 'auth.user.addresses', // Tried 'addresses`, 'user.addresses`, 'auth.user.addresses`,
titleAttribute: 'addres_line'
)
->preload()
->searchable(false)
->createOptionForm([
TextInput::make('line_one')
->required(),
])
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server