private function sortItemsToDays($items)
    {
        $all = [];

        foreach ($items as $item)
        {
            // date
            $timestamp = strtotime($item->created_at) * 1000;
            $day = Carbon::createFromFormat('Y-m-d H:i:s', $item->created_at)->format('Y-m-d');

            // init empty day
            if (!isset($all[$day])) {
                $all[$day] = [
                    'timestamp' => $timestamp,
                    'date' => $day,
                    'count' => 0,
                ];
            }

            // increase count
            $all[$day]['count']++;
        }

        return $all;
    }
private function sortItemsToDays($items)
    {
        $all = [];

        foreach ($items as $item)
        {
            // date
            $timestamp = strtotime($item->created_at) * 1000;
            $day = Carbon::createFromFormat('Y-m-d H:i:s', $item->created_at)->format('Y-m-d');

            // init empty day
            if (!isset($all[$day])) {
                $all[$day] = [
                    'timestamp' => $timestamp,
                    'date' => $day,
                    'count' => 0,
                ];
            }

            // increase count
            $all[$day]['count']++;
        }

        return $all;
    }
private function sortItemsToDays ( $ items ) { $ all = [ ] ; foreach ( $ items as $ item ) { // date $ timestamp = strtotime ( $ item -> created_at ) * 1000 ; $ day = Carbon :: createFromFormat ( 'Y-m-d H:i:s' , $ item -> created_at ) -> format ( 'Y-m-d' ) ; // init empty day if ( ! isset ( $ all [ $ day ] ) ) { $ all [ $ day ] = [ 'timestamp' => $ timestamp , 'date' => $ day , 'count' => 0 , ] ; } // increase count $ all [ $ day ] [ 'count' ] ++ ; } return $ all ; }
Sort items by day.

@param $items

@return array
Sort items by day .