F
Filament13mo ago
Emaz

Repeater basics

I'm sorry guys, I feel dumb asking. Maybe I'm over tired but I've been racking my brains in the docs and just can't see this simple thing. I have a to_do model and in that model is a nullable invoice_id. So each task can be optionally attached to an invoice. In my invoice edit form I collect some other data but I want to attach multiple to_dos. I thought I'd use a repeater but it's trying to CREATE a new to_do. I just want to attach multiple to_dos that already exist to this new invoice I'm creating. Can I not use a repeater for this? Cause this doesn't work. It tries to create a to_do.
No description
2 Replies
Emaz
Emaz13mo ago
SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value INSERT INTO to_dos (invoice_id, updated_at, created_at) VALUES (14, 2023 -10 -28 05: 26: 25, 2023 -10 -28 05: 26: 25)
ZedoX
ZedoX12mo ago
Sounds like its a BelongsToMany relationship.. docs clearly state that repeaters support HasMany & MorphMany relationship types. For BelongsToMany relationship you can use a Select with ->multiple() references: https://filamentphp.com/docs/3.x/panels/resources/relation-managers https://filamentphp.com/docs/3.x/forms/fields/select#integrating-with-an-eloquent-relationship
Want results from more Discord servers?
Add your server