forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerController.php
More file actions
51 lines (45 loc) · 1.42 KB
/
ServerController.php
File metadata and controls
51 lines (45 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace Pterodactyl\Http\Controllers\Admin\Servers;
use Illuminate\Http\Request;
use Illuminate\Contracts\View\Factory;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Repositories\Eloquent\ServerRepository;
class ServerController extends Controller
{
/**
* @var \Illuminate\Contracts\View\Factory
*/
private $view;
/**
* @var \Pterodactyl\Repositories\Eloquent\ServerRepository
*/
private $repository;
/**
* ServerController constructor.
*
* @param \Illuminate\Contracts\View\Factory $view
* @param \Pterodactyl\Repositories\Eloquent\ServerRepository $repository
*/
public function __construct(
Factory $view,
ServerRepository $repository
) {
$this->view = $view;
$this->repository = $repository;
}
/**
* Returns all of the servers that exist on the system using a paginated result set. If
* a query is passed along in the request it is also passed to the repository function.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View
*/
public function index(Request $request)
{
return $this->view->make('admin.servers.index', [
'servers' => $this->repository->setSearchTerm($request->input('query'))->getAllServers(
config()->get('pterodactyl.paginate.admin.servers')
),
]);
}
}