@php use App\Models\DataMou; use App\Models\DataRegistration; $profile = 0; $registration = 0; $user = Auth::user(); switch (Auth::user()->roles[0]->id) { case 7: // Admin Satker $data_mou = DataMou::select('data_mous.id') ->leftJoin('data_registrations AS dr', 'data_mous.id', 'dr.data_mou_id') ->where('dr.id', null) ->where('data_mous.pic', $user->work_unit_id); $data_profile = DataRegistration::select('data_registrations.id') ->join('data_mous AS dm', 'data_registrations.data_mou_id', 'dm.id') ->leftJoin('data_profiles AS dp', 'data_registrations.id', 'dp.data_registration_id') ->where('dp.id', null) ->where('dm.pic', $user->work_unit_id) ->where('dm.project_type', 'Pinjaman'); $profile = $data_profile->count(); $registration = $data_mou->count(); break; case 8: // Admin Uker $data_profile = DataRegistration::select('data_registrations.id') ->join('data_mous AS dm', 'data_registrations.data_mou_id', 'dm.id') ->leftJoin('data_profiles AS dp', 'data_registrations.id', 'dp.data_registration_id') ->where('dp.id', null) ->where('data_registrations.executor', $user->sub_work_unit_id) ->where('dm.project_type', 'Hibah'); $profile = $data_profile->count(); break; case 9: // Admin Super Satker $data_mou = DataMou::select('data_mous.id') ->leftJoin('data_registrations AS dr', 'data_mous.id', 'dr.data_mou_id') ->where('dr.id', null); $data_profile = DataRegistration::select('data_registrations.id') ->join('data_mous AS dm', 'data_registrations.data_mou_id', 'dm.id') ->leftJoin('data_profiles AS dp', 'data_registrations.id', 'dp.data_registration_id') ->where('dp.id', null) ->where('dm.project_type', 'Pinjaman'); $profile = $data_profile->count(); $registration = $data_mou->count(); break; case 10: // Admin Super Uker $data_profile = DataRegistration::select('data_registrations.id') ->join('data_mous AS dm', 'data_registrations.data_mou_id', 'dm.id') ->leftJoin('data_profiles AS dp', 'data_registrations.id', 'dp.data_registration_id') ->where('dp.id', null) ->where('dm.project_type', 'Hibah'); $profile = $data_profile->count(); break; } @endphp