mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 11:55:51 -05:00
22 lines
475 B
PHP
22 lines
475 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(trans('admin/user.exceptions.user_has_servers'));
|
|
}
|
|
|
|
return $user->delete();
|
|
}
|
|
}
|