2019-11-24 23:08:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Controllers\Admin\Nodes;
|
|
|
|
|
2022-10-14 16:59:20 +00:00
|
|
|
use Illuminate\View\View;
|
2019-11-24 23:08:54 +00:00
|
|
|
use Illuminate\Http\Request;
|
2020-09-13 19:21:44 +00:00
|
|
|
use Pterodactyl\Models\Node;
|
|
|
|
use Spatie\QueryBuilder\QueryBuilder;
|
2019-11-24 23:08:54 +00:00
|
|
|
use Pterodactyl\Http\Controllers\Controller;
|
2022-10-14 16:59:20 +00:00
|
|
|
use Illuminate\Contracts\View\Factory as ViewFactory;
|
2019-11-24 23:08:54 +00:00
|
|
|
|
|
|
|
class NodeController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* NodeController constructor.
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function __construct(private ViewFactory $view)
|
2019-11-24 23:08:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a listing of nodes on the system.
|
|
|
|
*/
|
2022-10-14 16:59:20 +00:00
|
|
|
public function index(Request $request): View
|
2019-11-24 23:08:54 +00:00
|
|
|
{
|
2020-09-13 19:21:44 +00:00
|
|
|
$nodes = QueryBuilder::for(
|
|
|
|
Node::query()->with('location')->withCount('servers')
|
|
|
|
)
|
|
|
|
->allowedFilters(['uuid', 'name'])
|
|
|
|
->allowedSorts(['id'])
|
|
|
|
->paginate(25);
|
2019-11-24 23:08:54 +00:00
|
|
|
|
2020-09-13 19:21:44 +00:00
|
|
|
return $this->view->make('admin.nodes.index', ['nodes' => $nodes]);
|
2019-11-24 23:08:54 +00:00
|
|
|
}
|
|
|
|
}
|