use $projects->all() instead of groups
changed mtime logic to max($project[last_activity_at])