From 9270eda907ba1e8b6309845af9cf05d327c02dc7 Mon Sep 17 00:00:00 2001 From: arieeefajar Date: Tue, 25 Mar 2025 19:05:00 +0700 Subject: [PATCH] fix(master-rule): fix view master rule --- .../Controllers/MasterData/RuleController.php | 3 ++- app/Models/Indicator.php | 6 +++++ .../views/master-data/aturan/index.blade.php | 22 +++++++++++++------ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/MasterData/RuleController.php b/app/Http/Controllers/MasterData/RuleController.php index 160bd29..4c21a42 100644 --- a/app/Http/Controllers/MasterData/RuleController.php +++ b/app/Http/Controllers/MasterData/RuleController.php @@ -12,8 +12,9 @@ class RuleController extends Controller { public function index() { - $rules = Rule::with('indicator')->orderBy('created_at', 'desc')->get(); + $rules = Indicator::with('rules')->get(); $indicators = Indicator::select('id', 'name')->get(); + // dd($rules); return view('master-data.aturan.index', compact('rules', 'indicators')); } diff --git a/app/Models/Indicator.php b/app/Models/Indicator.php index 50062cb..7e62ee2 100644 --- a/app/Models/Indicator.php +++ b/app/Models/Indicator.php @@ -11,4 +11,10 @@ class Indicator extends Model protected $table = 'indicators'; protected $guarded = []; + + + public function rules() + { + return $this->hasMany(Rule::class, 'indicator_id', 'id'); + } } diff --git a/resources/views/master-data/aturan/index.blade.php b/resources/views/master-data/aturan/index.blade.php index 254acf3..c827bef 100644 --- a/resources/views/master-data/aturan/index.blade.php +++ b/resources/views/master-data/aturan/index.blade.php @@ -61,10 +61,9 @@ Indikator - Ideal Min - Ideal Max + Jenis Indikator - Meansure Belief + CF(e) Action @@ -77,11 +76,20 @@ #VZ2101 - {{ $rule->indicator->name }} - {{ $rule->ideal_min }} - {{ $rule->ideal_max }} + {{ $rule->name }} + + + - {{ $rule->mb }} +