Replace nest repository
This commit is contained in:
parent
860b2d890b
commit
43e419fd7e
15 changed files with 40 additions and 186 deletions
|
@ -2,22 +2,13 @@
|
|||
|
||||
namespace Pterodactyl\Services\Nests;
|
||||
|
||||
use Pterodactyl\Contracts\Repository\NestRepositoryInterface;
|
||||
use Pterodactyl\Models\Nest;
|
||||
|
||||
class NestUpdateService
|
||||
{
|
||||
/**
|
||||
* NestUpdateService constructor.
|
||||
*/
|
||||
public function __construct(protected NestRepositoryInterface $repository)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a nest and prevent changing the author once it is set.
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function handle(int $nest, array $data): void
|
||||
{
|
||||
|
@ -25,6 +16,7 @@ class NestUpdateService
|
|||
unset($data['author']);
|
||||
}
|
||||
|
||||
$this->repository->withoutFreshModel()->update($nest, $data);
|
||||
$nest = Nest::query()->findOrFail($nest);
|
||||
$nest->update($data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue