Support the ongoing development of Laravel.io →
Authentication Session Database
Last updated 2 years ago.
0

ndar0430 said:

what im trying to do is upon submitting the details, the user_id of the submitter will be inserted in the database.

Inserting it into where?

Your code here:

$rfq= $user->rfq_table()->create($request->all());

Inserts everything from the form into the rfq_table, I'm guessing. Is that where you want to store the user_id? If it is, why not insert the user_id at the same time?

0

whatarewe said:

ndar0430 said:

what im trying to do is upon submitting the details, the user_id of the submitter will be inserted in the database.

Inserting it into where?

Your code here:

$rfq= $user->rfq_table()->create($request->all());

Inserts everything from the form into the rfq_table, I'm guessing. Is that where you want to store the user_id? If it is, why not insert the user_id at the same time?

its actually i copy paste code from a tutorial on youtube..

not really understand what that says.

actually i understand everything aside from the function store.

so maybe there's an alternative code where the user id(the authenticated user who click submit) will be save on the database

0

ndar0430 said:

not really understand what that says.

actually i understand everything aside from the function store.

so maybe there's an alternative code where the user id(the authenticated user who click submit) will be save on the database

Well, reading the documentation will be a start. But here's what happens.

  1. user types information into a form
  2. user clicks submit
  3. the browser submits information from the form to your controller
  4. $rfq= $user->rfq_table()->create($request->all()); saves every field from the form into the rfq_table.

There's a bit more to it than that. The rfq_table has a function called create() written for it that takes the information and inserts it to the database. So look for that function, and it'll be able to tell you exactly how it stores the information in the database. When you can understand that, you'll be able to pull the authenticated user id in the controller and pass it along to create() for it to be stored as well.

https://laracasts.com/ also has lots of videos that'll be able to explain it more in-depth, and probably do a better job than I'm doing right now.

0

whatarewe said:

ndar0430 said:

not really understand what that says.

actually i understand everything aside from the function store.

so maybe there's an alternative code where the user id(the authenticated user who click submit) will be save on the database

Well, reading the documentation will be a start. But here's what happens.

  1. user types information into a form
  2. user clicks submit
  3. the browser submits information from the form to your controller
  4. $rfq= $user->rfq_table()->create($request->all()); saves every field from the form into the rfq_table.

There's a bit more to it than that. The rfq_table has a function called create() written for it that takes the information and inserts it to the database. So look for that function, and it'll be able to tell you exactly how it stores the information in the database. When you can understand that, you'll be able to pull the authenticated user id in the controller and pass it along to create() for it to be stored as well.

https://laracasts.com/ also has lots of videos that'll be able to explain it more in-depth, and probably do a better job than I'm doing right now.

i now understand what u said but the thing is that i still don't know how to get the current login user ID to be inserted upon submission :( i hope you could help me im stuck here for days, we can do skype. i just really need it badly

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ndar0430 ndar0430 Joined 23 Feb 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.