How to create a Morphmany link to a nonexistent element?

  laravel, laravel-8

I have 2 tables with a MorphMany relationship.
Reviews and Images. The user must create a review and attach pictures to it, but the problem is that pictures according to the design are loaded before creating a review, and this is impossible since the model_type and model_id fields must be filled as in the screenshot. Do I create an empty review when a user visits filling out a review and then attach pictures to it so that I can change the parent for them after adding a real review? Because of this, there will be a lot of empty reviews in the database (garbage)


Source: Laravel

Leave a Reply