laravel-eloquent

Define Eloquent models, relationships, and queries for Laravel applications.

1|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/Jorge-Ivan/uam-hogar-nazareth-web --skill laravel-eloquent-jorge-ivan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-eloquent
Source: https://github.com/Jorge-Ivan/uam-hogar-nazareth-web/tree/main/.claude/skills/laravel-eloquent
Command: npx skills add https://github.com/Jorge-Ivan/uam-hogar-nazareth-web --skill laravel-eloquent-jorge-ivan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and tools for interacting with your database using Laravel's Eloquent ORM, ensuring efficient, secure, and maintainable data operations.

Core Features & Use Cases

  • Model Definition & Relationships: Define database tables as models and establish connections (one-to-one, one-to-many, many-to-many).
  • Querying & Optimization: Write efficient queries, eager load relationships to prevent N+1 problems, and optimize performance.
  • Data Manipulation: Handle attribute casting, accessors, mutators, and lifecycle events.
  • Testing: Generate test data using factories.
  • Use Case: When building a blog, you'll use Eloquent to define Post, User, and Comment models, link them via relationships, query posts with their authors, and ensure comments are loaded efficiently.

Quick Start

Use the laravel-eloquent skill to define a basic Eloquent model for a 'Product' with 'name' and 'price' fields.

Frequently Asked Questions about laravel-eloquent

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define Laravel Eloquent models and relationships for my database?

To define Laravel Eloquent models, you map database tables to model classes and establish connections like one-to-one, one-to-many, or many-to-many relationships. This approach lets you interact with your database using object-oriented syntax instead of raw SQL.

What is the best way to prevent N+1 query problems in Laravel Eloquent?

Preventing N+1 query problems in Laravel Eloquent is best achieved through eager loading. By using the `with` method to load relationships upfront, you minimize database queries and significantly optimize application performance.

How do I handle data manipulation and lifecycle events using Laravel Eloquent?

Handling data manipulation in Laravel Eloquent involves using attribute casting, accessors, mutators, and observers. These features allow you to automatically format data attributes and trigger custom logic during model lifecycle events like creation or updates.

Can I generate test data for Laravel Eloquent models using factories?

Yes, you can generate test data for Laravel Eloquent models using factories. Factories allow you to define dummy data attributes for your models, enabling you to efficiently populate your database for testing and development purposes.

Does this Laravel ORM guidance cover query builder optimization techniques?

Yes, this Laravel ORM guidance covers query builder optimization techniques. It helps you write efficient queries, properly load relationships to avoid performance bottlenecks, and maintain data integrity throughout your application's database interactions.