$model = DB::table('flight')
->select(
DB::raw("SUM(CASE WHEN status <> 'active' AND date <> '' AND date < CURRENT_DATE :: TEXT THEN 1 ELSE 0 END ) AS active_count"),
DB::raw("SUM(CASE WHEN status = 'deactive' THEN 1 ELSE 0 END) AS deactive_count")
)
->where(['delete_flg' => '0'])
->whereRaw("payment_status != 'Payment'" )
->whereRaw("CASE WHEN ".(RoleUtil::isOwner($roleId) ? 1 : 0)." = 1 THEN created_by = ".$userId. "
WHEN ".(RoleUtil::isHeadOfficeAdmin($roleId) ? 1 : 0)." = 1 THEN 1 = 1 END ")
->first();
->select(
DB::raw("SUM(CASE WHEN status <> 'active' AND date <> '' AND date < CURRENT_DATE :: TEXT THEN 1 ELSE 0 END ) AS active_count"),
DB::raw("SUM(CASE WHEN status = 'deactive' THEN 1 ELSE 0 END) AS deactive_count")
)
->where(['delete_flg' => '0'])
->whereRaw("payment_status != 'Payment'" )
->whereRaw("CASE WHEN ".(RoleUtil::isOwner($roleId) ? 1 : 0)." = 1 THEN created_by = ".$userId. "
WHEN ".(RoleUtil::isHeadOfficeAdmin($roleId) ? 1 : 0)." = 1 THEN 1 = 1 END ")
->first();
0 comments:
Post a Comment