パスワードを登録する際に、ランダムな文字列を生成したい時があります。
そのような時、Laravelではヘルパ関数を用いると簡単に生成する事ができます。
use Illuminate\Support\Str;
public function index()
{
//32文字生成
$random = Str::random(32);
return view('user.index',compact('random'));
}
<input type="text" value="{{ $random }}">