Artisan & CLI Beginner Since Laravel 10.x

artisan model:show

Inspect any Eloquent model's columns, relationships, observers, and policy from the command line.

Overview

php artisan model:show gives you a complete picture of an Eloquent model without opening a single file. It lists the database columns with types, all defined relationships, observers, and the associated policy.

Usage

php artisan model:show User

This outputs a table showing:

  • Attributes: column name, type, cast, nullable, default, unique, fillable/guarded
  • Relations: method name, type (HasMany, BelongsTo, etc.), related model
  • Observers: registered observer classes
  • Policy: the associated policy class, if any

You can also output as JSON:

php artisan model:show User --json

When to Use

  • Onboarding onto a new codebase — quickly understand what a model looks like
  • Debugging: verify casts, fillable fields, and relationships without reading the class
  • Documentation: pipe the JSON output into docs or wikis