From d4f2b57b0218efa45c99307e5084a969611078e7 Mon Sep 17 00:00:00 2001 From: cp6 Date: Sat, 5 Mar 2022 01:11:56 +1100 Subject: [PATCH] Added labels to dns show controller Added labels to dns show controller --- app/Http/Controllers/DNSController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/DNSController.php b/app/Http/Controllers/DNSController.php index 6e54dc1..30468eb 100644 --- a/app/Http/Controllers/DNSController.php +++ b/app/Http/Controllers/DNSController.php @@ -66,7 +66,13 @@ class DNSController extends Controller public function show(DNS $dn) { $dns = DNS::findOrFail($dn->id); - return view('dns.show', compact(['dn', 'dns'])); + + $labels = DB::table('labels_assigned as l') + ->join('labels', 'l.label_id', '=', 'labels.id') + ->where('l.service_id', '=', $dn->id) + ->get(['labels.label']); + + return view('dns.show', compact(['dn', 'dns', 'labels'])); } public function edit(DNS $dn)