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 Commented 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? Commented Nov 30, 2015 at 14:12
  • 1
    Have you tried anything? Commented 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...
   ]);

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.