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