main
Ilham Wara Nugroho 2026-04-08 15:12:59 +07:00
parent e059da856f
commit cd57095213
1 changed files with 6 additions and 6 deletions

View File

@ -70,15 +70,15 @@ class HomeController extends Controller
) as total_resource ) as total_resource
") ")
->value('total_resource'); ->value('total_resource');
$data['total'] = \DB::table('dataset as d') $data['total'] = Dataset::where('instansi_id', session('instansi_id'))
->where('d.instansi_id', session('instansi_id')) ->where('status',1)
->where('d.status',1) ->where('tahun',date('Y'))
->whereIn('d.template_id', function ($q) { ->whereIn('template_id', function ($q) {
$q->selectRaw('(jsonb_array_elements_text(resource_data::jsonb))::int') $q->selectRaw('(jsonb_array_elements_text(resource_data::jsonb))::int')
->from('ms_instansi') ->from('ms_instansi')
->where('MsInstansiId', session('instansi_id')); ->where('MsInstansiId', session('instansi_id'));
}) })->count();
->count();
// $data['total'] = Instansi::where('MsInstansiId',session('instansi_id'))->join('dataset as d', 'd.instansi_id', '=', 'ms_instansi.MsInstansiId') // $data['total'] = Instansi::where('MsInstansiId',session('instansi_id'))->join('dataset as d', 'd.instansi_id', '=', 'ms_instansi.MsInstansiId')
// ->whereRaw("ms_instansi.resource_data IS NOT NULL // ->whereRaw("ms_instansi.resource_data IS NOT NULL
// AND EXISTS ( // AND EXISTS (