0

How should I save values of form in two different tables in database using laravel. I have two tables one is saving only email and password, second is storing other information of user. How should I do this?

3
  • pleas give me sample code or tutorial related to this
    – Prashant
    Nov 30, 2015 at 11:09
  • Can you show us the Models you've created so far as well as the Controller method where you are saving the data? Nov 30, 2015 at 14:12
  • 1
    Have you tried anything?
    – smartrahat
    Nov 30, 2015 at 14:28

1 Answer 1

4

Have the form send to a particular Controller method and Store the pertinent data in their relative Models:

public function store(Request $request)
{
   User::create([
       'email' => $request->email,
       'password' => Hash::make($request->password)
   ]);

   Profile::create([
      'website' => $request->website,
      'address' => $request->address,
      // etc...
   ]);

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.