Answer the question
In order to leave comments, you need to log in
How to generate a password during registration and display this password in a letter?
This is what the user registration looks like:
public function store(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
]);
Auth::login($user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make(Str::random()),
]));
event(new Registered($user));
return [
'status' => true,
'url' => RouteServiceProvider::HOME
];
}
Answer the question
In order to leave comments, you need to log in
Then you can do this
$password = генерируешь пароль
In the store method
'password' => Hash::make($password),
Well, already in the event you send an email to the user with the $password variable
Maybe you can do it somehow differently, but this is the most obvious option
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question