использовать insertGetId ();
$id = DB::table('users')->insertGetId(
array(
'first_name' => $first_name,
'last_name' => $last_name,
'birth_date' => $birthDate,
'email' => $email,
'password' => $password,
'profession' => $profession,
'gender' => $gender,
'age' => $age
)
);
или просто красноречивый ларавел
$users = User::create([
'first_name' => $first_name,
'last_name' => $last_name,
'birth_date' => $birthDate,
'email' => $email,
'password' => $password,
'profession' => $profession,
'gender' => $gender,
'age' => $age
]);
dd($user->id); // If you modified Id add into model $primaryKey = "modified_id" $user->modified_id;