Skip to content

Artisan Commands

The starter includes several custom Artisan commands for managing your application’s database, configuration, and Northwestern integrations.

Completely rebuild the database by dropping all tables, running migrations, and executing all auto-discovered seeders.

Terminal window
php artisan db:rebuild

What it does:

  1. Drops all tables, views, and types
  2. Runs all migrations
  3. Executes all seeders marked with #[AutoSeed] attribute
  4. Regenerates IDE helper files

When to use:

  • Initial project setup
  • After pulling schema changes from git
  • When switching between feature branches with different schemas
  • Resetting test data during development

Related: db:wipe, migrate:fresh, db:seed


Display all auto-discovered seeders with their dependencies and execution order.

Terminal window
php artisan db:seed:list

Output example:

┌───┬──────────────────┬──────────────────────────────────┐
│ # │ Seeder │ Dependencies │
├───┼──────────────────┼──────────────────────────────────┤
│ 1 │ PermissionSeeder │ none │
│ 2 │ RoleTypeSeeder │ none │
│ 3 │ RoleSeeder │ RoleTypeSeeder, PermissionSeeder │
└───┴──────────────────┴──────────────────────────────────┘

When to use:

  • Verify seeder discovery and dependencies
  • Troubleshoot seeding order issues
  • Document available seeders for your team

See also: Idempotent Seeding documentation


Create a snapshot of the current database state.

Terminal window
php artisan db:snapshot:create my-snapshot-name

Options:

  • {name} - (optional) Descriptive name for the snapshot. Defaults to database-dump if omitted.
  • --skip-schema-validation - Skip schema validation checks

What it does:

  1. Validates database schema matches current migrations (unless skipped)
  2. Dumps database to database/snapshots/{name}.sql
  3. Stores metadata about the snapshot (checksum, timestamp, migration/seeder counts)

When to use:

  • Before making risky database changes
  • Saving a known-good state for testing
  • Creating test data fixtures
  • Preserving demo data

See also: Database Snapshots documentation


Restore a previously created database snapshot.

Terminal window
php artisan db:snapshot:restore my-snapshot-name

Options:

  • {name} - (optional) Name of the snapshot to restore. Defaults to database-dump if omitted.
  • --skip-schema-validation - Skip schema validation checks
  • --backup - Create a backup of the current database before restoring

What it does:

  1. Validates snapshot exists
  2. Checks schema compatibility (unless skipped)
  3. Creates a backup if requested
  4. Drops all current database tables
  5. Restores data from snapshot SQL file

When to use:

  • Resetting to a known state during testing
  • Recovering from bad data changes during development
  • Switching between test scenarios

List all available database snapshots.

Terminal window
php artisan db:snapshot:list

Display detailed information about a specific snapshot.

Terminal window
php artisan db:snapshot:info my-snapshot-name

Options:

  • {name} - (optional) Name of the snapshot to inspect. If omitted, an interactive selector is shown.

What it does:

  1. Displays file information (path, size, modification date)
  2. Shows schema metadata (checksum, migration/seeder counts)
  3. Compares snapshot schema with current codebase

When to use:

  • Verifying a snapshot’s contents before restoring
  • Checking if a snapshot is compatible with current code
  • Reviewing snapshot metadata

Delete a database snapshot and its associated metadata.

Terminal window
php artisan db:snapshot:delete my-snapshot-name

Options:

  • {name} - (optional) Name of the snapshot to delete. If omitted, an interactive selector is shown.
  • --all - Delete all snapshots

What it does:

  1. Removes the SQL snapshot file from database/snapshots/
  2. Cleans up associated metadata from the checksum map

When to use:

  • Removing old or unused snapshots
  • Freeing up disk space
  • Cleaning up after testing

Wake up a potentially-inactive serverless RDS database by establishing a connection.

Terminal window
php artisan db:wake

What it does:

Attempts to connect to the database and execute a simple query, causing serverless databases (like AWS Aurora Serverless) to wake from sleep mode.

When to use:

  • Before running migrations
  • As part of deployment scripts
  • When you know the database has been idle

Validate application configuration and environment variables.

Terminal window
php artisan config:validate

What it does:

Checks that all required environment variables are set and configuration is valid:

  • Northwestern API credentials (Directory Search, WebSSO, EventHub)
  • Database connection details
  • S3/MinIO configuration
  • Required app settings

When to use:

  • After initial installation
  • After environment variable changes
  • Before deployment
  • Troubleshooting integration issues

Send expiration reminder emails for access tokens approaching their expiration date.

Terminal window
php artisan access-tokens:notify-expiration

What it does:

  1. Queries for active access tokens with upcoming expiration dates
  2. Checks which tokens are due for notifications (30, 14, 7, 3, 1 days before)
  3. Sends reminder emails to token owners

See also: API Documentation


Run health checks for all external integrations and services.

Terminal window
php artisan health:check

What it does:

Validates connectivity and configuration for:

  • Database - Connection and query execution
  • S3/MinIO - Bucket access and write permissions
  • Directory Search API - API connectivity and test query
  • WebSSO/Entra ID - Authentication endpoint availability
  • EventHub - API endpoint accessibility (if configured)

When to use:

  • After deployment
  • Troubleshooting integration issues
  • Monitoring service connectivity
  • As part of CI/CD pipelines

Integration:

The /api/health endpoint also runs these checks for automated monitoring:

Terminal window
curl https://your-app.northwestern.edu/api/health

The starter uses laravel-ide-helper to generate IDE autocomplete files. These commands are automatically run after db:rebuild:

Generate IDE helper file for Laravel facades.

Terminal window
php artisan ide-helper:generate

Generate PHPDoc annotations for Eloquent models.

Terminal window
php artisan ide-helper:models --write --reset

Generate PhpStorm meta file for container bindings.

Terminal window
php artisan ide-helper:meta