mivita/app/Services/UserService.php
2020-08-07 16:02:03 +02:00

21 lines
No EOL
420 B
PHP

<?php
namespace App\Services;
use App\User;
class UserService
{
public static function createConfirmationCode() {
$unique = false;
do{
$confirmation_code = str_random(30);
if(User::where('confirmation_code', '=', $confirmation_code)->count() == 0){
$unique = true;
}
}
while(!$unique);
return $confirmation_code;
}
}