@muriel.schmidt
In Laravel, you can get the id of the inserted row using the insertGetId() method when inserting data into the database. Here's an example:
1 2 3 4 5 |
$id = DB::table('users')->insertGetId(
['name' => 'John Doe', 'email' => '[email protected]']
);
echo $id;
|
This code will insert a new row into the users table with the specified data and will return the id of the inserted row. You can then use this $id variable as needed in your application.