phpstormでlaravel5.8内でstr_random()を使ったらstr_random()みたいになったので、新しいメソッドを探した。
5.8系では、str_random()は、非推奨みたい。
use Illuminate\Support\Str;
$random_str = Str::random(100);
ちなみに5.8でstr_random()を呼ぶと内部でStr::random()が呼ばれるみたい。
vendor/laravel/framework/src/Illuminate/Support/helpers.phpより
if (! function_exists('str_random')) {
/**
* Generate a more truly "random" alpha-numeric string.
*
* @param int $length
* @return string
*
* @throws \RuntimeException
*
* @deprecated Str::random() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_random($length = 16)
{
return Str::random($length);
}
}
Laravel 5.8 New Features List
*) Deprecated String and Array Helpers Functions