laravel generate unique db token 1

laravel generate unique db token

use Illuminate\Support\Str;

public function yourFunction(){
 $var = Str::random(32);

 dd($var);
}

Here is what the above code is Doing:
1. We are using the Str facade to call the random method.
2. The random method takes a single argument, which is the length of the string we want to generate.
3. We are passing 32 as the length of the string we want to generate.
4. We are dumping and dieing the variable to see the output.

Similar Posts