Add increment id to mount, add basic mount view page

This commit is contained in:
Matthew Penner 2020-05-20 19:11:20 -06:00
parent 976b669059
commit 77150b2551
8 changed files with 203 additions and 12 deletions

View file

@ -5,6 +5,8 @@ namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\Mount;
use Illuminate\Support\Collection;
use Pterodactyl\Repositories\Concerns\Searchable;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
class MountRepository extends EloquentRepository
{
@ -29,4 +31,21 @@ class MountRepository extends EloquentRepository
{
return $this->getBuilder()->withCount('eggs', 'nodes')->get($this->getColumns());
}
/**
* Return all of the mounts and their respective relations.
*
* @param string $id
* @return mixed
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function getWithRelations(string $id): Mount
{
try {
return $this->getBuilder()->with('eggs', 'nodes')->findOrFail($id, $this->getColumns());
} catch (ModelNotFoundException $exception) {
throw new RecordNotFoundException;
}
}
}