Back to Skills

laravel-models

Eloquent model patterns and database layer. Use when working with models, database entities, Eloquent ORM, or when user mentions models, eloquent, relationships, casts, observers, database entities.

26stars7forksUpdated 3/3/2026

Security Assessment

Low Risk(85/100)

Detected risks:

Secret Exposure([SKILL.md] password =)
Security Score85/100

About laravel-models

The 'laravel-models' skill provides guidance on implementing and working with Eloquent models and database layers in Laravel applications. It addresses essential patterns for interacting with models, defining relationships, casting data types, and simplifying database operations using Laravel's ORM (Object-Relational Mapping). This skill is especially valuable for developers who need to manage complex database structures and interactions in an efficient and readable manner, following Laravel’s conventions and best practices.

FAQ

How do I define custom query builders for models?

You can define custom query builders by overriding the 'newEloquentBuilder' method in your model. This method allows you to return a custom builder class that extends the base Eloquent builder functionality, giving you the ability to add custom query logic.

What types of casts can I use for model attributes?

You can use a variety of cast types such as 'integer', 'float', 'boolean', 'array', 'json', 'date', 'datetime', 'timestamp', and more. You can also define custom casts or use classes for enums and DTOs.

Can I add business logic inside Eloquent models?

No, business logic should not reside in models. Models should focus on database interactions, while business logic belongs in dedicated Action classes.

Install laravel-models

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill