laravel-eloquent

Optimize Laravel Eloquent queries and model design patterns.

8|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/elmochilyas/laraskills --skill laravel-eloquent-elmochilyas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-eloquent
Source: https://github.com/elmochilyas/laraskills/tree/main/skills/laravel-eloquent
Command: npx skills add https://github.com/elmochilyas/laraskills --skill laravel-eloquent-elmochilyas

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill provides expert guidance on advanced Laravel Eloquent techniques to address complex domain modeling, performance optimization, and ORM features beyond simple CRUD operations.

Core Features & Use Cases

  • Advanced Eloquent Architecture: Deep dive into Eloquent's ORM, Data Mapper Hybrid, Query Builder, and Persistence Layer for domain-driven model design.
  • Performance Optimization: Techniques to prevent N+1 queries, implement eager loading constraints, and use selective columns.
  • Model Design: Explore DTO patterns, value objects, rich domain models, and repository alternatives for cleaner, more maintainable code.
  • Advanced Features: Learn about global and local scopes, custom builders, query macros, cast classes, encrypted casts, enums, model events, observers, and domain events.

Quick Start

Use the laravel-eloquent skill to enhance your Laravel application with advanced Eloquent features and optimize your model relationships and queries.

Frequently Asked Questions about laravel-eloquent

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

FAQPage Schema
How do I fix N+1 query problems in Laravel Eloquent?

To fix N+1 query problems in Laravel Eloquent, apply eager loading constraints and select only necessary columns. This Skill details performance optimization techniques to prevent inefficient database interactions and streamline relationship queries.

What is the best way to implement domain-driven design with Laravel Eloquent?

The best way to implement domain-driven design with Laravel Eloquent is using rich domain models, value objects, and DTO patterns. This Skill guides you through Data Mapper Hybrid architecture and repository alternatives for maintainable code.

How do I use custom builders and query macros in Eloquent ORM?

To use custom builders and query macros in Eloquent ORM, you extend the model's query scope. This Skill covers advanced Eloquent ORM features including global and local scopes, custom builders, and query macros for complex database interactions.

Can I use encrypted casts and enums in Laravel Eloquent models?

Yes, you can use encrypted casts and enums in Laravel Eloquent models. This Skill explains advanced model features including custom cast classes, encrypted casts, and enums to ensure robust data handling and domain modeling.

Does this Eloquent optimization approach require prior Laravel knowledge?

Yes, this Eloquent optimization approach requires prior Laravel and Eloquent knowledge. It focuses on advanced architecture, domain-driven design, and performance optimization techniques beyond basic CRUD operations.

When should I use model observers and domain events in Laravel?

You should use model observers and domain events in Laravel when handling complex lifecycle operations. This Skill covers model events, observers, and domain events to manage advanced Eloquent ORM features and robust domain modeling.