laravel-eloquent
Use when working with database models — Eloquent ORM, PHP attributes, relationships, queries, observers, or factories in Laravel 13.

Install laravel-eloquent in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Laravel Eloquent ORM (L13 — Attributes-first)
Agent Workflow (MANDATORY)
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
- fuse-ai-pilot:explore-codebase - Inspect existing models, mixed property/attribute usage
- fuse-ai-pilot:research-expert - Verify Laravel 13 Eloquent + Attributes docs via Context7
- mcp__context7__query-docs - Query attribute patterns (#[Fillable], #[Table], #[Scope])
After implementation, run fuse-ai-pilot:sniper for validation.
Overview
Laravel 13 promotes PHP 8.3 Attributes as the primary metadata mechanism on Eloquent models. Legacy properties ($fillable, $hidden, ...) remain supported for backward compatibility but should not be mixed with their attribute counterparts.
| Feature | Attribute (L13 MAIN) | Legacy property |
|---|---|---|
| Table name | #[Table('users')] |
protected $table |
| Mass assignment | #[Fillable([...])] |
protected $fillable |
| Hidden / Visible | #[Hidden([...])] / #[Visible([...])] |
protected $hidden / $visible |
| Guarded | #[Guarded([...])] / #[Unguarded] |
protected $guarded |
| Casts | no attribute — casts() method |
protected $casts |
| Appends | #[Appends([...])] |
protected $appends |
| Touches | #[Touches([...])] |
protected $touches |
| Connection | #[Connection('mysql')] |
protected $connection |
| Primary key | #[Table(key: 'uuid', keyType: 'string', incrementing: false)] (#[Table(key: false)] = no primary key, 13.39+) |
$primaryKey / $keyType / $incrementing |
| Timestamps off | #[WithoutTimestamps] |
public $timestamps = false |
| Refresh after write (13.33+) | #[Refreshes(['slug'])] |
— |
Critical Rules
- Attributes are the source of truth - Use
#[Fillable],#[Hidden],#[Table]on new code (casts stay incasts()) - Never mix attribute + property for the same concern (
#[Fillable]AND$fillable) - Eager load relationships - Prevent N+1 queries with
with() - No
new static()/new Model()inside the model's ownboot()/ traitboot*()- ThrowsLogicExceptionin L13 (nested booting disallowed) - Use factories in tests - Never hardcode test data
Architecture
app/Models/
├── User.php # #[Table], #[Fillable], #[Hidden] + casts()
├── Post.php # #[Connection], #[Appends], relationships
└── Concerns/
└── HasUuid.php # Reusable trait
→ See templates/ModelBasic.php.md
Reference Guide
Concepts
- Migration L12→L13: legacy-properties.md
- Modeling: models.md · casts.md · accessors-mutators.md · serialization.md · soft-deletes.md
- Relationships: relationships-basic.md · relationships-many-to-many.md · relationships-advanced.md · relationships-polymorphic.md
- Querying: eager-loading.md · scopes.md · aggregates.md · pagination.md · batch-operations.md · query-debugging.md
- Lifecycle / Output: events-observers.md · collections.md · resources.md · factories.md · transactions.md · performance.md
Templates
| Template | When to Use |
|---|---|
| ModelBasic.php.md | Attribute-based model |
| ModelRelationships.php.md | All relationship types |
| ModelCasts.php.md | casts() and accessors |
| Observer.php.md | Complete observer |
| Factory.php.md | Factory with states |
| [Resource.php.md](references/templa |
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- references/accessors-mutators.md
- references/aggregates.md
- references/batch-operations.md
- references/casts.md
- references/collections.md
- references/eager-loading.md
- references/events-observers.md
- references/factories.md
- references/legacy-properties.md
- references/models.md
- references/pagination.md
- references/performance.md
- references/query-debugging.md
- references/relationships-advanced.md
- references/relationships-basic.md
- references/relationships-many-to-many.md
- references/relationships-polymorphic.md
- references/resources.md
- references/scopes.md
- references/serialization.md
- references/soft-deletes.md
- references/templates/EagerLoadingExamples.php.md
- references/templates/Factory.php.md
- references/templates/ModelBasic.php.md
- references/templates/ModelCasts.php.md
- references/templates/ModelRelationships.php.md
- references/templates/Observer.php.md
- references/templates/Resource.php.md
- references/transactions.md
FAQ
What does the laravel-eloquent skill do?
Use when working with database models — Eloquent ORM, PHP attributes, relationships, queries, observers, or factories in Laravel 13.
How do I install the laravel-eloquent skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the laravel-eloquent skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
