How would i make a single request to insert in multiple tables using laravel Eloquent ORM relationship .ie
Table 1 : users
- id
- name
Table 2 : posts
- id
- user_id
- content
Table 3 : Image
- id
- user_id
- post_id
- image_name
relationship
- Table
usersid referencesuser_idin other two tables . - Table
postshas One To Many relation withusers. - Table
imageshas One To Many relation withusersandpostie it can be shared with other users and on other posts.
So that when one makes a post insert ,it should insert the record in the tables with a single query.