update
parent
51700323cb
commit
06ad739cf5
|
|
@ -70,15 +70,22 @@ class HomeController extends Controller
|
|||
) as total_resource
|
||||
")
|
||||
->value('total_resource');
|
||||
$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
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM jsonb_array_elements_text(ms_instansi.resource_data::jsonb) AS r(value)
|
||||
WHERE r.value = d.ms_tabel_data_id::text
|
||||
)
|
||||
")->distinct('ms_instansi.MsInstansiId')
|
||||
->count('ms_instansi.MsInstansiId');
|
||||
$data['total'] = \DB::table('dataset as d')
|
||||
->where('d.instansi_id', session('instansi_id'))
|
||||
->whereIn('d.template_id', function ($q) {
|
||||
$q->selectRaw('jsonb_array_elements_text(resource_data::jsonb)')
|
||||
->from('ms_instansi')
|
||||
->where('MsInstansiId', session('instansi_id'));
|
||||
})->count();
|
||||
// $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
|
||||
// AND EXISTS (
|
||||
// SELECT 1
|
||||
// FROM jsonb_array_elements_text(ms_instansi.resource_data::jsonb) AS r(value)
|
||||
// WHERE r.value = d.ms_tabel_data_id::text
|
||||
// )
|
||||
// ")->distinct('ms_instansi.MsInstansiId')
|
||||
// ->count('ms_instansi.MsInstansiId');
|
||||
|
||||
}
|
||||
$data['instansi'] = Instansi::count();
|
||||
|
|
|
|||
Loading…
Reference in New Issue