From 51de05b917596e59d36583be1a90872d0db0f82a Mon Sep 17 00:00:00 2001 From: cp6 Date: Sun, 20 Feb 2022 15:55:11 +1100 Subject: [PATCH] Added labels fetch for Domains show Added labels fetch for Domains show --- app/Http/Controllers/DomainsController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/DomainsController.php b/app/Http/Controllers/DomainsController.php index a28ca29..fcd9bf0 100644 --- a/app/Http/Controllers/DomainsController.php +++ b/app/Http/Controllers/DomainsController.php @@ -25,13 +25,19 @@ class DomainsController extends Controller public function show(Domains $domain) { + $service_extras = DB::table('domains as d') ->join('providers as p', 'd.provider_id', '=', 'p.id') ->join('pricings as pr', 'd.id', '=', 'pr.service_id') ->where('d.id', '=', $domain->id) ->get(['d.*', 'p.name as provider_name', 'pr.*']); - return view('domains.show', compact(['domain', 'service_extras'])); + $labels = DB::table('labels_assigned as l') + ->join('labels', 'l.label_id', '=', 'labels.id') + ->where('l.service_id', '=', $domain->id) + ->get(['labels.label']); + + return view('domains.show', compact(['domain', 'service_extras', 'labels'])); } public function create()