Saving Optional Relationship to db does not persist
Edit: This is not solved, only halfway there :(
Hey all,
I've been trying my hand at Laravel and filament for the last couple of weeks and am stuck on something:
I have two entities, Book and BookPoster. Both have their foreign_key value set as nullable (because a book might not have a poster at creation).
The BookResource's form looks as follows:
When selecting a BookPoster from the list, the value does not get persisted in database. Do you know what I might be doing wrong?
Hey all,
I've been trying my hand at Laravel and filament for the last couple of weeks and am stuck on something:
I have two entities, Book and BookPoster. Both have their foreign_key value set as nullable (because a book might not have a poster at creation).
The BookResource's form looks as follows:
When selecting a BookPoster from the list, the value does not get persisted in database. Do you know what I might be doing wrong?
Solution
Why do you have a
Honestly I don't know how this would work with laravel or fillament by default. You essentially have 2 different relations here - A
I think you will need to override the default create method if you want to change the
book_id on the book_poster table? Can a poster only post one book?Honestly I don't know how this would work with laravel or fillament by default. You essentially have 2 different relations here - A
poster had a book and a book has a poster but they can be different. I think you will need to override the default create method if you want to change the
book_id on the book_poster table (or use a mutateData... method)