Here is my code:
User::create([
'name' => $request->name,
'email' => $request->email,
'cell_phone' => $request->cell_phone,
'province_id' => $request->province,
'city_id' => $request->city,
'job' => $job,
'company' => $company,
'member_num' => $member_num,
]);
As you know, it inserts a new row in the database. Now I need to get the id
of inserted row. How can I get that?
Noted that I know, I can do the same if I use $obj->save()
, and the id will be $obj->id;
. But I want to know how can I do that when I'm using create()
.