main
Ilham Wara Nugroho 2026-02-20 14:29:25 +07:00
parent ed72dd2498
commit c59d005be6
2 changed files with 38 additions and 1 deletions

View File

@ -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 .= '<span class="p-1 bg-info rounded text-white">'.tabelById($value)->name.'</span>&nbsp;';
}
}
// $d .= '</ul>';
array_push($res, $d);
$res = implode("", $res);
}
return $res;
}
}
if (!function_exists('topikByDataset')) {
function topikByDataset($json){

View File

@ -72,7 +72,7 @@ class HomeController extends Controller
$_data[] = [
'no' => $key+1,
'name' => @$row->name,
'dataset' => '-',
'dataset' => tabelInstansi(@$row->MsInstansiId),
];
}