mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-02 12:25:44 -05:00
22 lines
462 B
PHP
22 lines
462 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Actions\Users;
|
|
|
|
use Pterodactyl\Contracts\Users\DeletesUsers;
|
|
use Pterodactyl\Exceptions\DisplayException;
|
|
use Pterodactyl\Models\User;
|
|
|
|
final class DeleteUser implements DeletesUsers
|
|
{
|
|
public function delete(User $user): ?bool
|
|
{
|
|
if ($user->servers()->exists()) {
|
|
throw new DisplayException(__('exceptions.users.has_servers'));
|
|
}
|
|
|
|
return $user->delete();
|
|
}
|
|
}
|