From dc78044e47339a77c2f694b704743df13b0b3f6f Mon Sep 17 00:00:00 2001 From: cp6 Date: Wed, 2 Mar 2022 23:57:45 +1100 Subject: [PATCH] Added locations view Added locations view --- app/Http/Controllers/LocationsController.php | 23 +++++++++ resources/views/locations/index.blade.php | 3 ++ resources/views/locations/show.blade.php | 54 ++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 resources/views/locations/show.blade.php diff --git a/app/Http/Controllers/LocationsController.php b/app/Http/Controllers/LocationsController.php index 9f6c302..88080e9 100644 --- a/app/Http/Controllers/LocationsController.php +++ b/app/Http/Controllers/LocationsController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Models\Locations; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; class LocationsController extends Controller @@ -33,6 +34,28 @@ class LocationsController extends Controller ->with('success', 'Location Created Successfully.'); } + public function show(Locations $location) + { + $servers = DB::table('servers as s') + ->where('s.location_id', '=', $location->id) + ->get(['s.id', 's.hostname']) + ->toArray(); + + $shared = DB::table('shared_hosting as s') + ->where('s.location_id', '=', $location->id) + ->get(['s.id', 's.main_domain as main_domain_shared']) + ->toArray(); + + $reseller = DB::table('reseller_hosting as r') + ->where('r.location_id', '=', $location->id) + ->get(['r.id', 'r.main_domain as main_domain_reseller']) + ->toArray(); + + $data = array_merge($servers, $shared, $reseller); + + return view('locations.show', compact(['location', 'data'])); + } + public function destroy(Locations $location) { $items = Locations::find($location->id); diff --git a/resources/views/locations/index.blade.php b/resources/views/locations/index.blade.php index ed0e66e..3d1080e 100644 --- a/resources/views/locations/index.blade.php +++ b/resources/views/locations/index.blade.php @@ -32,6 +32,9 @@ {{ $location->name }}
+ +
diff --git a/resources/views/locations/show.blade.php b/resources/views/locations/show.blade.php new file mode 100644 index 0000000..ab6e403 --- /dev/null +++ b/resources/views/locations/show.blade.php @@ -0,0 +1,54 @@ +@section('title') {{ $location->name }} {{'location'}} @endsection + + + {{ __('Location details') }} + +
+ +
+
+

{{ $location->name }}

+
+
+
{{ $location->id }}
+
+
+
+
+
+ + + @foreach($data as $l) + + + + + @endforeach + +
+ @if(isset($l->hostname)) + Server + @elseif(isset($l->main_domain_shared)) + Shared + @elseif(isset($l->main_domain_reseller)) + Reseller + @endif + + @if(isset($l->hostname)) + {{$l->hostname}} + @elseif(isset($l->main_domain_shared)) + {{$l->main_domain_shared}} + @elseif(isset($l->main_domain_reseller)) + {{$l->main_domain_reseller}} + @endif +
+
+
+
+ + {{ route('locations.index') }} + Go back + +
+
+