Update repository base code to be cleaner and make use of PHP 7 features

This commit is contained in:
Dane Everitt 2018-01-04 22:49:50 -06:00
parent 0ec5a4e08c
commit 60eb60013c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
96 changed files with 1048 additions and 1785 deletions

View file

@ -139,7 +139,6 @@ class DatabaseController extends Controller
* @param int $host
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/

View file

@ -126,7 +126,7 @@ class NodesController extends Controller
public function index(Request $request)
{
return view('admin.nodes.index', [
'nodes' => $this->repository->search($request->input('query'))->getNodeListingData(),
'nodes' => $this->repository->setSearchTerm($request->input('query'))->getNodeListingData(),
]);
}
@ -166,15 +166,15 @@ class NodesController extends Controller
/**
* Shows the index overview page for a specific node.
*
* @param int $node
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function viewIndex($node)
public function viewIndex(Node $node)
{
return view('admin.nodes.view.index', [
'node' => $this->repository->getSingleNode($node),
'node' => $this->repository->loadLocationAndServerCount($node),
'stats' => $this->repository->getUsageStats($node),
'version' => $this->versionService,
]);
@ -208,14 +208,14 @@ class NodesController extends Controller
/**
* Shows the allocation page for a specific node.
*
* @param int $node
* @param \Pterodactyl\Models\Node $node
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function viewAllocation($node)
public function viewAllocation(Node $node)
{
$node = $this->repository->getNodeAllocations($node);
$this->repository->loadNodeAllocations($node);
Javascript::put(['node' => collect($node)->only(['id'])]);
return view('admin.nodes.view.allocation', ['node' => $node]);

View file

@ -114,9 +114,7 @@ class PackController extends Controller
public function index(Request $request)
{
return view('admin.packs.index', [
'packs' => $this->repository->search($request->input('query'))->paginateWithEggAndServerCount(
$this->config->get('pterodactyl.paginate.admin.packs')
),
'packs' => $this->repository->setSearchTerm($request->input('query'))->paginateWithEggAndServerCount(),
]);
}
@ -177,14 +175,14 @@ class PackController extends Controller
/**
* Display pack view template to user.
*
* @param int $pack
* @param \Pterodactyl\Models\Pack $pack
* @return \Illuminate\View\View
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function view($pack)
public function view(Pack $pack)
{
return view('admin.packs.view', [
'pack' => $this->repository->getWithServers($pack),
'pack' => $this->repository->loadServerData($pack),
'nests' => $this->serviceRepository->getWithEggs(),
]);
}

View file

@ -352,14 +352,12 @@ class ServersController extends Controller
/**
* Display the database management page for a specific server.
*
* @param int $server
* @param \Pterodactyl\Models\Server $server
* @return \Illuminate\View\View
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function viewDatabase($server)
public function viewDatabase(Server $server)
{
$server = $this->repository->getWithDatabases($server);
$this->repository->loadDatabaseRelations($server);
return view('admin.servers.view.database', [
'hosts' => $this->databaseHostRepository->all(),

View file

@ -83,7 +83,7 @@ class UserController extends Controller
*/
public function index(Request $request)
{
$users = $this->repository->search($request->input('query'))->getAllUsersWithCounts();
$users = $this->repository->setSearchTerm($request->input('query'))->getAllUsersWithCounts();
return view('admin.users.index', ['users' => $users]);
}