Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
parent
95e15d2c8a
commit
cbcf62086f
573 changed files with 4387 additions and 9411 deletions
|
@ -15,39 +15,15 @@ use Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException;
|
|||
|
||||
class SubuserCreationService
|
||||
{
|
||||
/**
|
||||
* @var \Illuminate\Database\ConnectionInterface
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Repositories\Eloquent\SubuserRepository
|
||||
*/
|
||||
private $subuserRepository;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Users\UserCreationService
|
||||
*/
|
||||
private $userCreationService;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\UserRepositoryInterface
|
||||
*/
|
||||
private $userRepository;
|
||||
|
||||
/**
|
||||
* SubuserCreationService constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
ConnectionInterface $connection,
|
||||
SubuserRepository $subuserRepository,
|
||||
UserCreationService $userCreationService,
|
||||
UserRepositoryInterface $userRepository
|
||||
private ConnectionInterface $connection,
|
||||
private SubuserRepository $subuserRepository,
|
||||
private UserCreationService $userCreationService,
|
||||
private UserRepositoryInterface $userRepository
|
||||
) {
|
||||
$this->connection = $connection;
|
||||
$this->subuserRepository = $subuserRepository;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userCreationService = $userCreationService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +50,7 @@ class SubuserCreationService
|
|||
if ($subuserCount !== 0) {
|
||||
throw new ServerSubuserExistsException(trans('exceptions.subusers.subuser_exists'));
|
||||
}
|
||||
} catch (RecordNotFoundException $exception) {
|
||||
} catch (RecordNotFoundException) {
|
||||
// Just cap the username generated at 64 characters at most and then append a random string
|
||||
// to the end to make it "unique"...
|
||||
$username = substr(preg_replace('/([^\w\.-]+)/', '', strtok($email, '@')), 0, 64) . Str::random(3);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue