diff --git a/app/Http/Controllers/LabelsController.php b/app/Http/Controllers/LabelsController.php index 474fd11..da5c107 100644 --- a/app/Http/Controllers/LabelsController.php +++ b/app/Http/Controllers/LabelsController.php @@ -38,7 +38,16 @@ class LabelsController extends Controller public function show(Labels $label) { - return view('labels.show', compact(['label'])); + $labels = DB::table('labels_assigned as las') + ->leftJoin('pricings as p', 'las.service_id', '=', 'p.service_id') + ->leftJoin('servers as s', 'las.service_id', '=', 's.id') + ->leftJoin('shared_hosting as sh', 'las.service_id', '=', 'sh.id') + ->leftJoin('reseller_hosting as r', 'las.service_id', '=', 'r.id') + ->leftJoin('domains as d', 'las.service_id', '=', 'd.id') + ->where('las.label_id', '=', $label->id) + ->get(['p.service_type', 'p.service_id', 's.hostname', 'sh.main_domain as shared', 'r.main_domain as reseller', 'd.domain', 'd.extension']); + + return view('labels.show', compact(['label', 'labels'])); } public function edit(Labels $label) diff --git a/resources/views/labels/show.blade.php b/resources/views/labels/show.blade.php index d4c295b..af7d3ee 100644 --- a/resources/views/labels/show.blade.php +++ b/resources/views/labels/show.blade.php @@ -5,28 +5,54 @@
- - {{ route('labels.index') }} - Go back - +
+
+

{{ $label->label }}

+
+
+
{{ $label->id }}
+
+
- - - - - - - - + @foreach($labels as $label) + + + + + @endforeach
label name{{ $label->label}}
label id{{ $label->id}}
+ @if($label->service_type === 1) + Server + @elseif($label->service_type === 2) + Shared + @elseif($label->service_type === 3) + Reseller + @elseif($label->service_type === 4) + Domain + @endif + + @if($label->service_type === 1) + {{$label->hostname}} + @elseif($label->service_type === 2) + {{$label->shared}} + @elseif($label->service_type === 3) + {{$label->reseller}} + @elseif($label->service_type === 4) + {{$label->domain}}.{{$label->extension}} + @endif +
+ + {{ route('labels.index') }} + Go back +