I'm working on a API for a mobile app and I want to create a unique token for user validations. Currently i'm using str_random(30) function for that.
Basically I want to know that how str_random() function is working. Does it use any time stamp?
public function generateToken($user_id)
{
$randToken = str_random(30);
if (Token::updateOrCreate([
'user_id' => $user_id,
], [
'user_id' => $user_id,
"token" => $randToken
])
) {
return $randToken;
}
return "";
}