From 1f33eebf3ca1bef318887c1670c20c8384d8b9c6 Mon Sep 17 00:00:00 2001 From: cp6 Date: Thu, 3 Mar 2022 00:00:58 +1100 Subject: [PATCH] Added providers view Added providers view --- app/Http/Controllers/ProvidersController.php | 25 ++++++++- resources/views/providers/index.blade.php | 3 ++ resources/views/providers/show.blade.php | 54 ++++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 resources/views/providers/show.blade.php diff --git a/app/Http/Controllers/ProvidersController.php b/app/Http/Controllers/ProvidersController.php index d253b17..8d669a3 100644 --- a/app/Http/Controllers/ProvidersController.php +++ b/app/Http/Controllers/ProvidersController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use App\Models\Providers; use DataTables; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; class ProvidersController extends Controller { @@ -33,6 +34,28 @@ class ProvidersController extends Controller ->with('success', 'Provider Created Successfully.'); } + public function show(Providers $provider) + { + $servers = DB::table('servers as s') + ->where('s.provider_id', '=', $provider->id) + ->get(['s.id', 's.hostname']) + ->toArray(); + + $shared = DB::table('shared_hosting as s') + ->where('s.provider_id', '=', $provider->id) + ->get(['s.id', 's.main_domain as main_domain_shared']) + ->toArray(); + + $reseller = DB::table('reseller_hosting as r') + ->where('r.provider_id', '=', $provider->id) + ->get(['r.id', 'r.main_domain as main_domain_reseller']) + ->toArray(); + + $data = array_merge($servers, $shared, $reseller); + + return view('providers.show', compact(['provider', 'data'])); + } + public function destroy(Providers $provider) { $items = Providers::find($provider->id); @@ -49,7 +72,7 @@ class ProvidersController extends Controller $data = Providers::latest()->get(); $dt = Datatables::of($data) ->addIndexColumn() - ->addColumn('action', function($row){ + ->addColumn('action', function ($row) { $actionBtn = 'Edit Delete'; return $actionBtn; }) diff --git a/resources/views/providers/index.blade.php b/resources/views/providers/index.blade.php index 5153bf5..5b94b90 100644 --- a/resources/views/providers/index.blade.php +++ b/resources/views/providers/index.blade.php @@ -32,6 +32,9 @@ {{ $provider->name }}
+ +
diff --git a/resources/views/providers/show.blade.php b/resources/views/providers/show.blade.php new file mode 100644 index 0000000..12d0de4 --- /dev/null +++ b/resources/views/providers/show.blade.php @@ -0,0 +1,54 @@ +@section('title') {{ $provider->name }} {{'provider'}} @endsection + + + {{ __('Provider details') }} + +
+ +
+
+

{{ $provider->name }}

+
+
+
{{ $provider->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('providers.index') }} + Go back + +
+
+