Replace nest repository
This commit is contained in:
parent
860b2d890b
commit
43e419fd7e
15 changed files with 40 additions and 186 deletions
|
@ -4,7 +4,6 @@ namespace Pterodactyl\Services\Nests;
|
|||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
||||
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
||||
|
||||
class NestCreationService
|
||||
|
@ -12,7 +11,7 @@ class NestCreationService
|
|||
/**
|
||||
* NestCreationService constructor.
|
||||
*/
|
||||
public function __construct(private ConfigRepository $config, private NestRepositoryInterface $repository)
|
||||
public function __construct(private ConfigRepository $config)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -23,11 +22,14 @@ class NestCreationService
|
|||
*/
|
||||
public function handle(array $data, string $author = null): Nest
|
||||
{
|
||||
return $this->repository->create([
|
||||
/** @var Nest $nest */
|
||||
$nest = Nest::query()->create([
|
||||
'uuid' => Uuid::uuid4()->toString(),
|
||||
'author' => $author ?? $this->config->get('pterodactyl.service.author'),
|
||||
'name' => array_get($data, 'name'),
|
||||
'description' => array_get($data, 'description'),
|
||||
], true, true);
|
||||
]);
|
||||
|
||||
return $nest;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue