laravel-models

Standardize Laravel Eloquent models with casts, relationships, and observers.

1|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/nextplus896/durra-alaseel --skill laravel-models
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-models
Source: https://github.com/nextplus896/durra-alaseel/tree/main/.github/skills/claude-laravel/laravel-models
Command: npx skills add https://github.com/nextplus896/durra-alaseel --skill laravel-models

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Laravel Eloquent models are standardized and simplified for consistent domain access.

Core Features & Use Cases

  • Define casts
  • Define relationships (BelongsTo, HasMany, etc.)
  • Add accessors & mutators
  • Use observers for lifecycle hooks
  • Keep business logic out of models; delegate to Actions
  • Structure for organization (concerns, contracts, etc.)

Quick Start

Create a basic Laravel model with casts and relationships, apply a HasUuid trait if needed, set up an observer, and register the model bootstrapping in AppServiceProvider. Ensure models are unguarded globally via Model::unguard() as described in the guide.

Frequently Asked Questions about laravel-models

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

FAQPage Schema
How do I keep business logic out of Laravel Eloquent models?

Structuring Laravel Eloquent models involves using concerns and contracts to organize traits like HasUuid. It enforces unguarded models globally via Model::unguard() and applies custom query builders for consistent domain access.

What is the best way to set up Laravel model casts and relationships?

The best way to set up Laravel model casts and relationships is to define them directly within the Eloquent model class. This standardizes data access and simplifies typical domain operations across your project.

How do I use observers for Laravel model lifecycle hooks?

To use observers for Laravel model lifecycle hooks, create an observer class to handle events, then register the model bootstrapping within the AppServiceProvider. This keeps lifecycle logic separated from the core model.

Do I need to unguard Laravel models globally to use custom query builders?

Yes, unguarding Laravel models globally via Model::unguard() is required by this standardization approach. It ensures consistent domain access and allows custom query builders to function without mass assignment interference.