How can I make one query to insert into multiple tables using laravel Eloquent ORM relationship.ie
Table 1: Users
Table 2: Messages
Table 3: Image
- ID
- user_id
- post_id
- image_name
relations
- The
usersid reference table user_idin the other two tables. - The table
postsis related to One To Many s users. - The table
imageshas One To Many relationship with usersand post, that is, it can be shared with other users and other messages.
So, when you create a post insert, it should insert a record into tables with a single query.