misc_pterodactyl-panel/app/Repositories/Eloquent/DatabaseHostRepository.php

30 lines
745 B
PHP
Raw Permalink Normal View History

<?php
namespace Pterodactyl\Repositories\Eloquent;
use Illuminate\Support\Collection;
2017-08-05 22:26:30 +00:00
use Pterodactyl\Models\DatabaseHost;
use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
2017-07-15 16:52:34 +00:00
class DatabaseHostRepository extends EloquentRepository implements DatabaseHostRepositoryInterface
{
/**
* Return the model backing this repository.
*
* @return string
*/
public function model()
{
return DatabaseHost::class;
}
/**
* Return database hosts with a count of databases and the node
* information for which it is attached.
*/
public function getWithViewDetails(): Collection
{
return $this->getBuilder()->withCount('databases')->with('node')->get();
}
}