Update labels show

Update labels show
This commit is contained in:
cp6 2022-03-02 01:12:20 +11:00
parent 298dc28dc6
commit 7adb5ddff2
2 changed files with 48 additions and 13 deletions

View File

@ -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)

View File

@ -5,28 +5,54 @@
</x-slot>
<div class="container">
<x-card class="shadow mt-3">
<x-back-button>
<x-slot name="href">{{ route('labels.index') }}</x-slot>
Go back
</x-back-button>
<div class="row">
<div class="col-12 col-md-6 mb-2">
<h2>{{ $label->label }}</h2>
</div>
<div class="col-12 col-md-6 text-md-end">
<h6 class="text-muted pe-lg-4">{{ $label->id }}</h6>
</div>
</div>
<div class="row">
<div class="col-12 col-lg-6">
<div class="table-responsive">
<table class="table table-borderless text-nowrap">
<tbody>
<tr>
<td class="px-4 py-2 font-bold">label name</td>
<td>{{ $label->label}}</td>
</tr>
<tr>
<td class="px-4 py-2 font-bold">label id</td>
<td><code>{{ $label->id}}</code></td>
</tr>
@foreach($labels as $label)
<tr>
<td class="py-2 text-muted">
@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
</td>
<td>
@if($label->service_type === 1)
<a href="{{ route('servers.show', $label->service_id) }}" class="text-decoration-none">{{$label->hostname}}</a>
@elseif($label->service_type === 2)
<a href="{{ route('shared.show', $label->service_id) }}" class="text-decoration-none">{{$label->shared}}</a>
@elseif($label->service_type === 3)
<a href="{{ route('reseller.show', $label->service_id) }}" class="text-decoration-none">{{$label->reseller}}</a>
@elseif($label->service_type === 4)
<a href="{{ route('domains.show', $label->service_id) }}" class="text-decoration-none">{{$label->domain}}.{{$label->extension}}</a>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<x-back-button>
<x-slot name="href">{{ route('labels.index') }}</x-slot>
Go back
</x-back-button>
</x-card>
</div>
</x-app-layout>