Tutorial last revisioned on August 11, 2022 with Laravel 9
This is a really really short one. I just needed to generate a random password for a user and noticed that Google doesn't really give a one-line answer, which is really simple.
Firstly, how to generate random string - Laravel has a helper called str_random($length). In terms of saving hashed password to database, we use Hash::make($password).
So the end result for generating 8-symbol length password looks as simple as this: