Eloquent is a new object relational mapper (ORM) that helps to interact with database. With Eloquent each table has a mapping Model that takes care of all the operations on that table.
$data = new User; $data->temporary_token = $token; $data->name = $name; $data->email = $userdet->email; $data->password = Hash::make($userdet->email); $data->save(); $ID = $data->id;
$insertedId = DB::table('your_table_name')
->insertGetId([
'column1' => 'value1',
'column2' => 'value2',
'column3' => 'value3',
]);
echo $insertedId; // This will output the ID of the newly inserted record