I got an error "Call to undefined function App\loginIdExists()" anyone can show the right method ?
public static function generateLoginId() {
$number = mt_rand(1000000000, 9999999999); // better than rand()
// call the same function if the barcode exists already
if (loginIdExists($number)) {
return generateLoginId();
}
// otherwise, it's valid and can be used
return $number;
}
public static function loginIdExists($number) {
// query the database and return a boolean
// for instance, it might look like this in Laravel
$concated_number = 'COD'.$number;
return User::where('login_id',$concated_number)->exists();
}