›
›
›
  1. docs
  2. ›
  3. byrcsc/laravel-customer-health
1.x
Browse documentationOpenClose

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Product events
  • Features and milestones
  • Onboarding
  • Health scores
  • Summaries and tenancy

Operations

  • Querying customer health
  • Queueing events
  • Recomputing scores
  • Retention and erasure
  • Production operations

Reference

  • Configuration
  • Public API
  • Events
  • Console commands
  • Database storage
  • Testing
  • Troubleshooting

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Product events
  • Features and milestones
  • Onboarding
  • Health scores
  • Summaries and tenancy

Operations

  • Querying customer health
  • Queueing events
  • Recomputing scores
  • Retention and erasure
  • Production operations

Reference

  • Configuration
  • Public API
  • Events
  • Console commands
  • Database storage
  • Testing
  • Troubleshooting

byrcsc/laravel-customer-health · 1.x

Console commands.

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

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
OptionConstraint
--scoreRegistered score name; empty or unknown values fail
--subjectNon-empty Type:id; type may be a morph alias or model class
--chunkPositive 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

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-42

The 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.

What to read next

  • Recomputing scores for scheduling and partial failure handling.
  • Retention and erasure for transaction boundaries during purge.
  • Troubleshooting for command failure causes.
PreviousEventsNextDatabase storage
View source

On this page

  1. customer-health:recompute
  2. customer-health:purge
  3. What to read next