auditionadmin/app/Services/UserService.php

24 lines
361 B
PHP

<?php
namespace App\Services;
use App\Models\User;
class UserService
{
public function __construct()
{
}
public function userExists(User $user): bool
{
static $allUserIds = null;
if ($allUserIds === null) {
$allUserIds = User::pluck('id');
}
return $allUserIds->contains($user->id);
}
}