laravel-models
Laravel Models
Models represent database tables and domain entities.
Related guides:
- Query Builders - Custom query builders (not scopes)
- Actions - Actions contain business logic
- DTOs - Casting model JSON columns to DTOs
Philosophy
Models should:
- Use custom query builders (not local scopes) - see Query Builders
- Define relationships
- Define casts
- Contain simple accessors/mutators
- NOT contain business logic (that belongs in Actions)
- Prefer PHP attributes over properties/methods where available (Laravel 12+ for
#[UseEloquentBuilder], Laravel 13+ for#[Table],#[ObservedBy],#[UsePolicy],#[UseFactory], etc.)
More from leeovery/agentic-skills
laravel-quality
Code quality tooling with PHPStan, Pint, and strict types. Use when configuring or running static analysis, code style, or linting.
26laravel-testing
Comprehensive testing patterns with Pest. Use when writing or modifying tests, mocking, factories, or test patterns.
25laravel-query-builders
Custom query builders for type-safe, composable database queries. Use when creating or modifying query builders, query scopes, or complex database queries.
25laravel-architecture
High-level architecture decisions, patterns, and project structure. Use when deciding which pattern to use, organizing code, or making structural decisions.
23laravel-providers
Service providers, bootstrapping, and application configuration. Use when modifying service providers, booters, bootstrap logic, or app-level configuration.
23laravel-validation
Form request validation and comprehensive validation testing. Use when creating or modifying form requests, validation rules, or validation tests.
23