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