959 0 0 0
Last Updated : 2025-11-02 02:07:14
this snippet will teach you how to generate random passwords in laravel through laravel helper functions
you can create random password through laravel helper function like this
$random_password = Str::random(40);
//$random_password = Str::random(lengthofpassword);Don't forget to use str like this
use Illuminate\Support\Str;use hash to create hashed password from generated random password like this
$hashed_password = Hash::make(str::random(40));
//OR
$hashed_password = Hash::make($random_password); Don't forget to use hash like this
use Illuminate\Support\Facades\Hash;