Fix CLI `*:list` commands query load times with eager loading and counts
Overview
When running CLI *:list
commands, multiple records are lazy loaded. As the count of records increases, the SQL query becomes inefficient and takes a long time to load, or fails to load before timing out. By adding eager loading ->with(['relationship'])
and counts ->withCount(['childRecords'])
to the Eloquent query, the loading time decreases from 30s to <1s.
New Features
- Add eager loading and counts to
*:list
CLI commands to improve response times for lists of records.
Closes #157
Edited by Jeff Martin