From c59d005be6ae12639dee682855fabb373bad01f7 Mon Sep 17 00:00:00 2001 From: Ilham Wara Nugroho Date: Fri, 20 Feb 2026 14:29:25 +0700 Subject: [PATCH] update --- app/Helpers/custom.php | 37 +++++++++++++++++++++++++ app/Http/Controllers/HomeController.php | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index bf94088..05a5db0 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -7,8 +7,10 @@ use App\Models\Master\Menu; use App\Models\Master\AccessMenu; use App\Models\User; use App\Models\Master\Group; +use App\Models\Master\Instansi; use App\Models\Master\Dataset; use App\Models\Master\Topik; +use App\Models\Master\TabelData; use App\Models\Log; if (!function_exists('taskLabel')) { @@ -385,6 +387,41 @@ if (!function_exists('topikById')) { } } +if (!function_exists('tabelById')) { + function tabelById($id){ + $keyId = decode_id($id); + $tabel = TabelData::find($keyId); + return $tabel; + } +} + +if (!function_exists('tabelInstansi')) { + function tabelInstansi($idInstansi){ + + // $table = Dataset::find($id); + $instansi = Instansi::find($idInstansi); + + $decode = json_decode($instansi->resource_data); + $res = "Belum ada data"; + if(@$decode){ + $res = []; + $d = ''; + foreach ($decode as $key => $value) { + if (($value !== null) && ($value !== "")) { + $d .= ''.tabelById($value)->name.' '; + } + + } + // $d .= ''; + array_push($res, $d); + + $res = implode("", $res); + } + + return $res; + } +} + if (!function_exists('topikByDataset')) { function topikByDataset($json){ diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index c218cbf..db23952 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -72,7 +72,7 @@ class HomeController extends Controller $_data[] = [ 'no' => $key+1, 'name' => @$row->name, - 'dataset' => '-', + 'dataset' => tabelInstansi(@$row->MsInstansiId), ]; }