11<?php
2- /**
3- * Pterodactyl - Panel
4- * Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5- *
6- * This software is licensed under the terms of the MIT license.
7- * https://opensource.org/licenses/MIT
8- */
92
103namespace Pterodactyl \Http \Controllers \Admin ;
114
1912use Pterodactyl \Http \Requests \Admin \DatabaseHostFormRequest ;
2013use Pterodactyl \Services \Databases \Hosts \HostCreationService ;
2114use Pterodactyl \Services \Databases \Hosts \HostDeletionService ;
15+ use Pterodactyl \Contracts \Repository \DatabaseRepositoryInterface ;
2216use Pterodactyl \Contracts \Repository \LocationRepositoryInterface ;
2317use Pterodactyl \Contracts \Repository \DatabaseHostRepositoryInterface ;
2418
@@ -34,6 +28,11 @@ class DatabaseController extends Controller
3428 */
3529 private $ creationService ;
3630
31+ /**
32+ * @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface
33+ */
34+ private $ databaseRepository ;
35+
3736 /**
3837 * @var \Pterodactyl\Services\Databases\Hosts\HostDeletionService
3938 */
@@ -59,6 +58,7 @@ class DatabaseController extends Controller
5958 *
6059 * @param \Prologue\Alerts\AlertsMessageBag $alert
6160 * @param \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface $repository
61+ * @param \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface $databaseRepository
6262 * @param \Pterodactyl\Services\Databases\Hosts\HostCreationService $creationService
6363 * @param \Pterodactyl\Services\Databases\Hosts\HostDeletionService $deletionService
6464 * @param \Pterodactyl\Services\Databases\Hosts\HostUpdateService $updateService
@@ -67,13 +67,15 @@ class DatabaseController extends Controller
6767 public function __construct (
6868 AlertsMessageBag $ alert ,
6969 DatabaseHostRepositoryInterface $ repository ,
70+ DatabaseRepositoryInterface $ databaseRepository ,
7071 HostCreationService $ creationService ,
7172 HostDeletionService $ deletionService ,
7273 HostUpdateService $ updateService ,
7374 LocationRepositoryInterface $ locationRepository
7475 ) {
7576 $ this ->alert = $ alert ;
7677 $ this ->creationService = $ creationService ;
78+ $ this ->databaseRepository = $ databaseRepository ;
7779 $ this ->deletionService = $ deletionService ;
7880 $ this ->repository = $ repository ;
7981 $ this ->locationRepository = $ locationRepository ;
@@ -105,7 +107,8 @@ public function view(int $host): View
105107 {
106108 return view ('admin.databases.view ' , [
107109 'locations ' => $ this ->locationRepository ->getAllWithNodes (),
108- 'host ' => $ this ->repository ->getWithServers ($ host ),
110+ 'host ' => $ this ->repository ->find ($ host ),
111+ 'databases ' => $ this ->databaseRepository ->getDatabasesForHost ($ host ),
109112 ]);
110113 }
111114
0 commit comments