foreach($countStats as $key => &$item) {
             if(!isset($unitNameMap[$item['unit_name']]) || !isset($expireDetection[$item['unit_name']])) {
                 unset($countStats[$key]);
                 continue;
             }
             $item = [
                 'id' => $item['unit_name'],
                 'name' => $unitNameMap[$item['unit_name']],
                 'count' => $item['count'],
                 'expire' => $expireDetection[$item['unit_name']],
                 'expire_rate' => $item['count'] <= 0 || $expireDetection[$item['unit_name']] <= 0? 0: (sprintf("%.2f",$expireDetection[$item[' unit_name']] / $item['count'] * 100)),
             ];
         }

         array_multisort(array_column($countStats,'expire'),SORT_DESC,$countStats);

         return collection($countStats)->values();
Likes(0)

Comment list count 0 Comments

No Comments