How to Insert and get id in laravel?
Use insertGetId(); it gives you the id of an inserted row.
$userId = User::insertGetId([
'name' => $request->input('name'),
'email' => $request->input('email'),
'password' => bcrypt($request->input('password')),
]);