2424
2525namespace Pterodactyl \Http \Controllers \Admin ;
2626
27+ use Pterodactyl \Contracts \Repository \LocationRepositoryInterface ;
2728use Pterodactyl \Models \Location ;
2829use Prologue \Alerts \AlertsMessageBag ;
2930use Pterodactyl \Exceptions \DisplayException ;
3031use Pterodactyl \Http \Controllers \Controller ;
3132use Pterodactyl \Http \Requests \Admin \LocationRequest ;
32- use Pterodactyl \Services \Administrative \ LocationService ;
33+ use Pterodactyl \Services \LocationService ;
3334
3435class LocationController extends Controller
3536{
@@ -39,29 +40,29 @@ class LocationController extends Controller
3940 protected $ alert ;
4041
4142 /**
42- * @var \Pterodactyl\Models\Location
43+ * @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface
4344 */
44- protected $ locationModel ;
45+ protected $ repository ;
4546
4647 /**
47- * @var \Pterodactyl\Services\Administrative\ \LocationService
48+ * @var \Pterodactyl\Services\\LocationService
4849 */
4950 protected $ service ;
5051
5152 /**
5253 * LocationController constructor.
5354 *
54- * @param \Prologue\Alerts\AlertsMessageBag $alert
55- * @param \Pterodactyl\Models\Location $locationModel
56- * @param \Pterodactyl\Services\Administrative\ LocationService $service
55+ * @param \Prologue\Alerts\AlertsMessageBag $alert
56+ * @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
57+ * @param \Pterodactyl\Services\LocationService $service
5758 */
5859 public function __construct (
5960 AlertsMessageBag $ alert ,
60- Location $ locationModel ,
61+ LocationRepositoryInterface $ repository ,
6162 LocationService $ service
6263 ) {
6364 $ this ->alert = $ alert ;
64- $ this ->locationModel = $ locationModel ;
65+ $ this ->repository = $ repository ;
6566 $ this ->service = $ service ;
6667 }
6768
@@ -73,21 +74,21 @@ public function __construct(
7374 public function index ()
7475 {
7576 return view ('admin.locations.index ' , [
76- 'locations ' => $ this ->locationModel -> withCount ( ' nodes ' , ' servers ' )-> get (),
77+ 'locations ' => $ this ->repository -> allWithDetails (),
7778 ]);
7879 }
7980
8081 /**
8182 * Return the location view page.
8283 *
83- * @param \Pterodactyl\Models\Location $location
84+ * @param int $id
8485 * @return \Illuminate\View\View
8586 */
86- public function view (Location $ location )
87+ public function view ($ id )
8788 {
88- $ location -> load ( ' nodes.servers ' );
89-
90- return view ( ' admin.locations.view ' , [ ' location ' => $ location ]);
89+ return view ( ' admin.locations.view ' , [
90+ ' location ' => $ this -> repository -> getWithNodes ( $ id ),
91+ ]);
9192 }
9293
9394 /**
@@ -132,7 +133,7 @@ public function update(LocationRequest $request, Location $location)
132133 /**
133134 * Delete a location from the system.
134135 *
135- * @param \Pterodactyl\Models\Location $location
136+ * @param \Pterodactyl\Models\Location $location
136137 * @return \Illuminate\Http\RedirectResponse
137138 *
138139 * @throws \Exception
0 commit comments