Remove ServerRepository and ServerRepositoryInterface
This commit is contained in:
parent
22d560de64
commit
4d7ea155b1
19 changed files with 63 additions and 146 deletions
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Repositories\Eloquent;
|
||||
|
||||
use Pterodactyl\Models\Server;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
|
||||
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
||||
|
||||
class ServerRepository extends EloquentRepository implements ServerRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Return the model backing this repository.
|
||||
*/
|
||||
public function model(): string
|
||||
{
|
||||
return Server::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a server by UUID.
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function getByUuid(string $uuid): Server
|
||||
{
|
||||
try {
|
||||
/** @var \Pterodactyl\Models\Server $model */
|
||||
$model = $this->getBuilder()
|
||||
->with('nest', 'node')
|
||||
->where(function (Builder $query) use ($uuid) {
|
||||
$query->where('uuidShort', $uuid)->orWhere('uuid', $uuid);
|
||||
})
|
||||
->firstOrFail($this->getColumns());
|
||||
|
||||
return $model;
|
||||
} catch (ModelNotFoundException) {
|
||||
throw new RecordNotFoundException();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue