How to Insert Relationship Via Controller

Solved
keshan-sandeepa

Sep 4th, 2018 09:44 AM

Hello , I have 2 models , one is user other one is register , "User hasone register " i need to create that relationship , Problem is even i created data is not saving in database, here is the screen shots in my code :

  1. Register Model https://imgur.com/a/xdEZthE
  2. User Model https://imgur.com/a/EMY8n76

Here is my controller Screenshot

  1. https://imgur.com/a/UuFLLJA

Problem is itsnot saving when user fill my form , How to fixed that . help me =D

mark

Sep 5th, 2018 11:40 AM

Best Answer

Add $customer->save(); after $customer->id = $request->user_id;.


Best Regards,
Mark Topper (Maintainer of Laravel Voyager)
Mail: [email protected]
I am available for freelance work - hire me