diff --git a/app/Http/Controllers/Admin/LocationsController.php b/app/Http/Controllers/Admin/LocationsController.php new file mode 100644 index 000000000..190050948 --- /dev/null +++ b/app/Http/Controllers/Admin/LocationsController.php @@ -0,0 +1,35 @@ + Models\Location::select( + 'locations.*', + DB::raw('(SELECT COUNT(*) FROM nodes WHERE nodes.location = locations.id) as a_nodeCount'), + DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node IN (SELECT nodes.id FROM nodes WHERE nodes.location = locations.id)) as a_serverCount') + )->paginate(20) + ]); + } + + public function postView(Request $request) + { + $location = Models\Location::findOrFail($request->input('location_id')); + } + +} diff --git a/app/Http/Routes/AdminRoutes.php b/app/Http/Routes/AdminRoutes.php index 0fbb12cab..568cae4b0 100644 --- a/app/Http/Routes/AdminRoutes.php +++ b/app/Http/Routes/AdminRoutes.php @@ -199,6 +199,20 @@ class AdminRoutes { }); + // Server Routes + $router->group([ + 'prefix' => 'admin/locations', + 'middleware' => [ + 'auth', + 'admin' + ] + ], function () use ($router) { + $router->get('/', [ + 'as' => 'admin.locations', + 'uses' => 'Admin\LocationsController@getIndex' + ]); + }); + } } diff --git a/resources/views/admin/locations/index.blade.php b/resources/views/admin/locations/index.blade.php new file mode 100644 index 000000000..be73c9503 --- /dev/null +++ b/resources/views/admin/locations/index.blade.php @@ -0,0 +1,43 @@ +@extends('layouts.admin') + +@section('title') + Location List +@endsection + +@section('content') +
+ +

All Locations


+ + + + + + + + + + + @foreach ($locations as $location) + + + + + + + @endforeach + +
LocationDescriptionNodesServers
{{ $location->short }}{{ $location->long }}{{ $location->a_nodeCount }}{{ $location->a_serverCount }}
+
+
{!! $locations->render() !!}
+
+
+ +@endsection