81939/how-can-i-insert-data-in-relation-table-using-model
i have a two table 1).customers (id,name,address) and 2nd table Orders(id,item,price,Customers_id)
This is my model
This is my controller
Any help please?
Hello @Alisha,
Try to work using the model and not the DB, there are many features that you loose because of it. $user->order()->create( $arrayOfdata)
Hope it works!! Thank you!!
The code change depending of the type of relationship, 1-1, n-n, 1-n. so there is no specific code, it will be customized according to user requirement
You can find all the details depending of the type of relationship, 1-1, n-n, 1-n here:https://laravel.com/docs/7.x/eloquent-relationships#inserting-and-updating-related-models
Hope it helps!!
Hii @kartik, This is simple task to send single ...READ MORE
Yes it is possible. You can either ...READ MORE
Hello @kartik, You can solve this error by ...READ MORE
Hello @kartik, It is always best practice to ...READ MORE
1. Create Middleware Function : - Define a ...READ MORE
Node.js is an open source server environment ...READ MORE
Hello @ subham , If you want to access the ...READ MORE
Hi Kartik, try the following script <script> (window.onload = ...READ MORE
Hello @kartik, This should do it: <Text> Hi~{"\n"} this is a ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.