2015-12-06 13:58:49 -05:00
|
|
|
<?php
|
2016-12-07 22:46:38 +00:00
|
|
|
|
2015-12-06 13:58:49 -05:00
|
|
|
namespace Pterodactyl\Http\Controllers\Base;
|
|
|
|
|
2016-12-07 22:46:38 +00:00
|
|
|
use Illuminate\Http\Request;
|
2018-01-04 22:49:50 -06:00
|
|
|
use Pterodactyl\Models\User;
|
2015-12-06 13:58:49 -05:00
|
|
|
use Pterodactyl\Http\Controllers\Controller;
|
2017-08-30 21:14:20 -05:00
|
|
|
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
|
2016-10-14 17:15:36 -04:00
|
|
|
|
2015-12-06 13:58:49 -05:00
|
|
|
class IndexController extends Controller
|
|
|
|
{
|
2017-08-30 21:11:14 -05:00
|
|
|
/**
|
|
|
|
* @var \Pterodactyl\Contracts\Repository\ServerRepositoryInterface
|
|
|
|
*/
|
|
|
|
protected $repository;
|
2017-04-01 13:14:49 -04:00
|
|
|
|
2017-08-30 21:11:14 -05:00
|
|
|
/**
|
|
|
|
* IndexController constructor.
|
|
|
|
*
|
2019-08-17 16:03:10 -07:00
|
|
|
* @param \Pterodactyl\Contracts\Repository\ServerRepositoryInterface $repository
|
2017-08-30 21:11:14 -05:00
|
|
|
*/
|
2019-08-17 16:03:10 -07:00
|
|
|
public function __construct(ServerRepositoryInterface $repository)
|
|
|
|
{
|
2017-08-30 21:11:14 -05:00
|
|
|
$this->repository = $repository;
|
2015-12-06 13:58:49 -05:00
|
|
|
}
|
|
|
|
|
2015-12-12 00:21:17 -06:00
|
|
|
/**
|
2017-08-30 21:11:14 -05:00
|
|
|
* Returns listing of user's servers.
|
2015-12-12 00:21:17 -06:00
|
|
|
*
|
2017-08-21 22:10:48 -05:00
|
|
|
* @param \Illuminate\Http\Request $request
|
2017-08-30 21:11:14 -05:00
|
|
|
* @return \Illuminate\View\View
|
2015-12-12 00:21:17 -06:00
|
|
|
*/
|
2018-05-26 17:20:36 -07:00
|
|
|
public function index(Request $request)
|
2015-12-12 00:21:17 -06:00
|
|
|
{
|
2018-01-04 22:49:50 -06:00
|
|
|
$servers = $this->repository->setSearchTerm($request->input('query'))->filterUserAccessServers(
|
2018-11-10 12:38:35 -08:00
|
|
|
$request->user(), User::FILTER_LEVEL_ALL, config('pterodactyl.paginate.frontend.servers')
|
2017-08-30 21:11:14 -05:00
|
|
|
);
|
2016-12-01 19:16:40 -05:00
|
|
|
|
2018-05-26 17:20:36 -07:00
|
|
|
return view('templates/base.core', ['servers' => $servers]);
|
2015-12-12 00:21:17 -06:00
|
|
|
}
|
2015-12-06 13:58:49 -05:00
|
|
|
}
|