File tree Expand file tree Collapse file tree 3 files changed +92
-0
lines changed
resources/views/admin/locations Expand file tree Collapse file tree 3 files changed +92
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Pterodactyl \Http \Controllers \Admin ;
4+
5+ use DB ;
6+
7+ use Pterodactyl \Models ;
8+ use Pterodactyl \Http \Controllers \Controller ;
9+ use Illuminate \Http \Request ;
10+
11+ class LocationsController extends Controller
12+ {
13+
14+ public function __construct ()
15+ {
16+ //
17+ }
18+
19+ public function getIndex (Request $ request )
20+ {
21+ return view ('admin.locations.index ' , [
22+ 'locations ' => Models \Location::select (
23+ 'locations.* ' ,
24+ DB ::raw ('(SELECT COUNT(*) FROM nodes WHERE nodes.location = locations.id) as a_nodeCount ' ),
25+ DB ::raw ('(SELECT COUNT(*) FROM servers WHERE servers.node IN (SELECT nodes.id FROM nodes WHERE nodes.location = locations.id)) as a_serverCount ' )
26+ )->paginate (20 )
27+ ]);
28+ }
29+
30+ public function postView (Request $ request )
31+ {
32+ $ location = Models \Location::findOrFail ($ request ->input ('location_id ' ));
33+ }
34+
35+ }
Original file line number Diff line number Diff line change @@ -199,6 +199,20 @@ public function map(Router $router) {
199199
200200 });
201201
202+ // Server Routes
203+ $ router ->group ([
204+ 'prefix ' => 'admin/locations ' ,
205+ 'middleware ' => [
206+ 'auth ' ,
207+ 'admin '
208+ ]
209+ ], function () use ($ router ) {
210+ $ router ->get ('/ ' , [
211+ 'as ' => 'admin.locations ' ,
212+ 'uses ' => 'Admin\LocationsController@getIndex '
213+ ]);
214+ });
215+
202216 }
203217
204218}
Original file line number Diff line number Diff line change 1+ @extends (' layouts.admin' )
2+
3+ @section (' title' )
4+ Location List
5+ @endsection
6+
7+ @section (' content' )
8+ <div class =" col-md-12" >
9+ <ul class =" breadcrumb" >
10+ <li ><a href =" /admin" >Admin Control</a ></li >
11+ <li class =" active" >Locations</li >
12+ </ul >
13+ <h3 >All Locations</h3 ><hr />
14+ <table class =" table table-bordered table-hover table-striped" >
15+ <thead >
16+ <tr >
17+ <th >Location</th >
18+ <th >Description</th >
19+ <th class =" text-center" >Nodes</th >
20+ <th class =" text-center" >Servers</th >
21+ </tr >
22+ </thead >
23+ <tbody >
24+ @foreach ($locations as $location )
25+ <tr >
26+ <td ><a href =" #/edit/{{ $location -> id } }" data-action =" edit" data-location =" {{ $location -> id } }" ><code >{{ $location -> short } } </code ></td >
27+ <td >{{ $location -> long } } </td >
28+ <td class =" text-center" >{{ $location -> a_nodeCount } } </td >
29+ <td class =" text-center" >{{ $location -> a_serverCount } } </td >
30+ </tr >
31+ @endforeach
32+ </tbody >
33+ </table >
34+ <div class =" row" >
35+ <div class =" col-md-12 text-center" >{!! $locations -> render () ! !} </div >
36+ </div >
37+ </div >
38+ <script >
39+ $ (document ).ready (function () {
40+ $ (' #sidebar_links' ).find (" a[href='/admin/locations']" ).addClass (' active' );
41+ });
42+ </script >
43+ @endsection
You can’t perform that action at this time.
0 commit comments