›
byrcsc/laravel-customer-health · 1.x
Reference score recomputation and subject erasure commands, options, output, and exit codes.
Use these Artisan commands to refresh stored scores or erase one subject's package data.
customer-health:recompute
{--score= : Limit recomputation to one registered score key}
{--subject= : Limit recomputation to one Type:id subject identity}
{--chunk=500 : Number of known subjects to load at once}The command finds distinct identities from the events and milestones tables.
For every resolved Trackable subject, it computes the selected score or every
registered score.
Examples:
php artisan customer-health:recompute
php artisan customer-health:recompute --score=customer_health
php artisan customer-health:recompute --subject='team:42'
php artisan customer-health:recompute \
--score=customer_health \
--subject='App\Models\Team:42' \
--chunk=100| Option | Constraint |
|---|---|
--score | Registered score name; empty or unknown values fail |
--subject | Non-empty Type:id; type may be a morph alias or model class |
--chunk | Positive integer; defaults to 500 |
The progress total is the known-subject count multiplied by the selected score count.
A subject failure is printed as:
Failed [Type:id]: <exception message>The command continues with other subjects and ends with:
Recomputed <count> health score(s). <count> subject(s) failed.It returns Command::SUCCESS only when every subject succeeds. Invalid options
also return Command::FAILURE.
When retention_days is shorter than the longest registered
WindowedSignal, the command warns that recomputed activity scores may ignore
pruned events.
customer-health:purge
{subject_type : Model class or morph alias}
{subject_id : Model key}
{--tenant= : Override the tenant id matched in landlord summaries}Examples:
php artisan customer-health:purge team 42
php artisan customer-health:purge \
'App\Models\Team' 42 \
--tenant=tenant-42The command resolves the model through its morph identity. It returns failure
without deleting when the type or ID is empty, the model does not exist, or the
resolved model does not implement Trackable.
On success it removes matching events, milestones, score history, and the summary row for the resolved or overridden tenant ID. It prints:
Purged customer health data for [Type:id].The command does not prompt for confirmation. Confirm the exact subject and tenant identity in the calling workflow before execution.