plugins/laravel-expert/skills/laravel-eloquent/SKILL.md
Complete Eloquent ORM for Laravel 13 - PHP Attributes (#[Table],
npx skillsauth add fusengine/agents laravel-eloquentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before ANY implementation, use TeamCreate to spawn 3 agents:
After implementation, run fuse-ai-pilot:sniper for validation.
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 | #[Casts([...])] | casts() method |
| Appends | #[Appends([...])] | protected $appends |
| Touches | #[Touches([...])] | protected $touches |
| Connection | #[Connection('mysql')] | protected $connection |
#[Fillable], #[Casts], #[Hidden] on new code#[Fillable] AND $fillable)with()new Model() in boot() - Throws LogicException in L13 (booted lifecycle protected)app/Models/
├── User.php # #[Table], #[Fillable], #[Hidden], #[Casts]
├── Post.php # #[Connection], #[Appends], relationships
└── Concerns/
└── HasUuid.php # Reusable trait
→ See templates/ModelBasic.php.md
| 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 | API resource | | EagerLoadingExamples.php.md | N+1 prevention |
use Illuminate\Database\Eloquent\Attributes\{Table, Fillable, Hidden, Casts};
use Illuminate\Database\Eloquent\Model;
#[Table('users')]
#[Fillable(['name', 'email', 'password'])]
#[Hidden(['password', 'remember_token'])]
#[Casts(['email_verified_at' => 'datetime', 'is_admin' => 'boolean'])]
final class User extends Model
{
public function posts(): HasMany
{
return $this->hasMany(Post::class);
}
}
#[Scope]
protected function published(Builder $query): void
{
$query->whereNotNull('published_at');
}
// Usage: Post::published()->get();
$posts = Post::with('author')->get(); // 2 queries, not N+1
→ Legacy $fillable / $hidden style — see legacy-properties.md
#[Table], #[Fillable], #[Casts], ...)final on model classes when not extendedwith()#[Casts]#[Fillable] and $fillable on the same model (conflict — single source of truth)boot() / booted() — L13 throws LogicException#[Unguarded] in productiontesting
Copy self-audit and ban-lists — filler verbs/hype adjectives, slop placeholder names, fake-precise numbers, Title Case headlines, humor in error copy ('Oops!'), em-dash crutch, one copy register per page.
development
Logged-in web apps — dashboards, auth flows, settings, onboarding, data tables, command palettes, modals, toasts. Register `product`: density and glance-speed over marketing polish, no hero/CTA-tricks, every data surface covers empty/loading/error explicitly, tables and dataviz follow preattentive-processing rules.
development
Marketing sites, landing pages, campaign pages — register `brand` (design IS the product). Structure comes from the register's POV + a macrostructure pick, never from copying an inspiration site's section flow. Hero discipline, deviated section order, asymmetric grids, and a silhouette lookalike-test gate before ship.
development
Token-strategy core — OKLCH color rules, neutral tinting, accent-commitment levels, type scale, 8pt spacing grid, touch targets, and the canonical output format of design-system.md (the file the harness gates on). This is routing step 1 of design-method/SKILL.md — read it before design-web/design-webapp/design-ios/design-android, before picking or auditing a single color/type/spacing value.