99
1010namespace Pterodactyl \Http \Controllers \Admin ;
1111
12+ use Illuminate \View \View ;
1213use Pterodactyl \Models \Service ;
14+ use Illuminate \Http \RedirectResponse ;
1315use Prologue \Alerts \AlertsMessageBag ;
1416use Pterodactyl \Http \Controllers \Controller ;
1517use Pterodactyl \Services \Services \ServiceUpdateService ;
@@ -46,6 +48,15 @@ class ServiceController extends Controller
4648 */
4749 protected $ updateService ;
4850
51+ /**
52+ * ServiceController constructor.
53+ *
54+ * @param \Prologue\Alerts\AlertsMessageBag $alert
55+ * @param \Pterodactyl\Services\Services\ServiceCreationService $creationService
56+ * @param \Pterodactyl\Services\Services\ServiceDeletionService $deletionService
57+ * @param \Pterodactyl\Contracts\Repository\ServiceRepositoryInterface $repository
58+ * @param \Pterodactyl\Services\Services\ServiceUpdateService $updateService
59+ */
4960 public function __construct (
5061 AlertsMessageBag $ alert ,
5162 ServiceCreationService $ creationService ,
@@ -65,10 +76,10 @@ public function __construct(
6576 *
6677 * @return \Illuminate\View\View
6778 */
68- public function index ()
79+ public function index (): View
6980 {
7081 return view ('admin.services.index ' , [
71- 'services ' => $ this ->repository ->getWithOptions (),
82+ 'services ' => $ this ->repository ->getWithCounts (),
7283 ]);
7384 }
7485
@@ -77,7 +88,7 @@ public function index()
7788 *
7889 * @return \Illuminate\View\View
7990 */
80- public function create ()
91+ public function create (): View
8192 {
8293 return view ('admin.services.new ' );
8394 }
@@ -88,7 +99,7 @@ public function create()
8899 * @param int $service
89100 * @return \Illuminate\View\View
90101 */
91- public function view ($ service )
102+ public function view (int $ service ): View
92103 {
93104 return view ('admin.services.view ' , [
94105 'service ' => $ this ->repository ->getWithOptionServers ($ service ),
@@ -101,7 +112,7 @@ public function view($service)
101112 * @param \Pterodactyl\Models\Service $service
102113 * @return \Illuminate\View\View
103114 */
104- public function viewFunctions (Service $ service )
115+ public function viewFunctions (Service $ service ): View
105116 {
106117 return view ('admin.services.functions ' , ['service ' => $ service ]);
107118 }
@@ -114,7 +125,7 @@ public function viewFunctions(Service $service)
114125 *
115126 * @throws \Pterodactyl\Exceptions\Model\DataValidationException
116127 */
117- public function store (ServiceFormRequest $ request )
128+ public function store (ServiceFormRequest $ request ): RedirectResponse
118129 {
119130 $ service = $ this ->creationService ->handle ($ request ->normalize ());
120131 $ this ->alert ->success (trans ('admin/services.notices.service_created ' , ['name ' => $ service ->name ]))->flash ();
@@ -132,7 +143,7 @@ public function store(ServiceFormRequest $request)
132143 * @throws \Pterodactyl\Exceptions\Model\DataValidationException
133144 * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
134145 */
135- public function update (ServiceFormRequest $ request , Service $ service )
146+ public function update (ServiceFormRequest $ request , Service $ service ): RedirectResponse
136147 {
137148 $ this ->updateService ->handle ($ service ->id , $ request ->normalize ());
138149 $ this ->alert ->success (trans ('admin/services.notices.service_updated ' ))->flash ();
@@ -150,7 +161,7 @@ public function update(ServiceFormRequest $request, Service $service)
150161 * @throws \Pterodactyl\Exceptions\Model\DataValidationException
151162 * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
152163 */
153- public function updateFunctions (ServiceFunctionsFormRequest $ request , Service $ service )
164+ public function updateFunctions (ServiceFunctionsFormRequest $ request , Service $ service ): RedirectResponse
154165 {
155166 $ this ->updateService ->handle ($ service ->id , $ request ->normalize ());
156167 $ this ->alert ->success (trans ('admin/services.notices.functions_updated ' ))->flash ();
@@ -166,7 +177,7 @@ public function updateFunctions(ServiceFunctionsFormRequest $request, Service $s
166177 *
167178 * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException
168179 */
169- public function destroy (Service $ service )
180+ public function destroy (Service $ service ): RedirectResponse
170181 {
171182 $ this ->deletionService ->handle ($ service ->id );
172183 $ this ->alert ->success (trans ('admin/services.notices.service_deleted ' ))->flash ();
0 commit comments