Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

laravel-ops

БесплатноЗапускает вложенные скриптыНе проверен

Laravel framework patterns, Eloquent ORM, authentication, queues, and testing. Use for: laravel, eloquent, artisan, blade, php, sanctum, livewire, inertia…

0xDarkMatterот 0xDarkMatter★ 86 звёзд на GitHub

Об этом скилле

Laravel Operations

Facts verified as of 2026-07.

Authoritative reference for Laravel 11+ development: architecture decisions, Eloquent patterns, authentication strategies, queue configuration, and testing approaches.


Architecture Decision Tree

What type of application?
│
├─ Full-stack web (HTML responses)
│  ├─ Simple CRUD, small team → Monolith (Blade + Eloquent directly)
│  │   └─ Use action classes for business logic over 20 lines
│  ├─ Rich interactivity needed → Livewire (server-driven reactivity)
│  │   └─ Add Alpine.js for client-side micro-interactions
│  └─ SPA-like feel, React/Vue team → Inertia.js
│      └─ Keep server-side routing, dump client-side routing overhead
│
├─ API backend (JSON responses)
│  ├─ Single consumer (mobile/SPA) → API-only with Sanctum SPA auth
│  ├─ Multiple consumers / public → RESTful API with token auth
│  └─ Complex graph queries → Consider GraphQL (lighthouse-php/lighthouse)
│
├─ Large team / complex domain
│  ├─ Domain-driven → Modular monolith (app/Modules/{Domain}/)
│  │   ├─ Each module: Models, Actions, Events, Jobs, Http/
│  │   └─ Shared: app/Shared/ for cross-cutting concerns
│  └─ Independent deployability needed → Microservices
│      └─ Use Laravel Octane for high-throughput services
│
└─ What business logic pattern?
   ├─ Simple CRUD, < 20 lines → Direct Eloquent in controller
   ├─ Reusable operation (create order, send invoice) → Action class
   │   └─ Single public handle() or execute() method
   ├─ Complex queries, multiple data sources → Repository pattern
   │   └─ Interface + Eloquent implementation (enables swapping)
   └─ Cross-cutting operations (audit, caching) → Service class
       └─ Inject via constructor, bind in ServiceProvider

Action Class vs Repository vs Service

Pattern Use When Example
Action class Single, reusable business operation CreateOrderAction, SendInvoiceAction
Repository Abstract data access, multiple sources OrderRepository with EloquentOrderRepository
Service Orchestrate multiple actions/repos OrderService combining payment + inventory
Direct Eloquent Simple CRUD, < 5 lines in controller User::create($data)

Eloquent Quick Reference

Relationships

Relationship Method Foreign Key Convention
hasOne return $this->hasOne(Profile::class) profiles.user_id
hasMany return $this->hasMany(Post::class) posts.user_id
belongsTo return $this->belongsTo(User::class) posts.user_id
belongsToMany return $this->belongsToMany(Role::class) role_user pivot
hasManyThrough return $this->hasManyThrough(Post::class, User::class) Country → User → Post
morphTo return $this->morphTo() {col}_type, {col}_id
morphMany return $this->morphMany(Comment::class, 'commentable') Polymorphic
morphToMany return $this->morphToMany(Tag::class, 'taggable') Polymorphic pivot

Eager Loading

// Prevent N+1: always eager load in controllers
$posts = Post::with(['author', 'comments.author', 'tags'])->paginate(15);

// Conditional eager loading (load after retrieval)
$user->load('posts.comments');
$user->loadMissing('posts'); // only if not already loaded

// Eager load counts (no SELECT *)
$posts = Post::withCount('comments')->get();

// Constrained eager loading
$posts = Post::with(['comments' => fn($q) => $q->approved()->latest()])->get();

Query Scopes

// Local scope (reusable query constraint)
public function scopeActive(Builder $query): void
{
    $query->where('status', 'active');
}

// Usage: User::active()->get()

// Dynamic scope
public function scopeOfType(Builder $query, string $type): void
{
    $query->where('type', $type);
}
// Usage: User::ofType('admin')->get()

Mass Assignment

// Fillable (allowlist - preferred)
protected $fillable = ['name', 'email', 'password'];

// Guarded (denylist - use [] only if you trust all input)
protected $guarded = ['id', 'is_admin'];

// Never set guarded = [] in production code

Artisan Command Cheat Sheet

Command Purpose Common Options
make:model Post -mfs Model + migration + factory + seeder -c controller, -r resource
make:controller PostController -r Resource controller (7 methods) --api skips create/edit
make:request StorePostRequest Form request for validation
make:job ProcessPayment Queueable job class --sync for sync job
make:event OrderPlaced Event class
make:listener SendOrderConfirmation -e OrderPlaced Listener for event --queued
make:notification InvoicePaid Notification class
make:policy PostPolicy -m Post Policy with model
make:middleware EnsureUserIsAdmin HTTP middleware
make:command SendDailyReport Custom Artisan comma
Полный SKILL.md на GitHub

Установить laravel-ops в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Bash

Вложенные файлы

assets/.gitkeepreferences/architecture.mdreferences/eloquent-queries.mdreferences/testing-auth.mdscripts/.gitkeep

FAQ

Что делает скилл laravel-ops?

Laravel framework patterns, Eloquent ORM, authentication, queues, and testing. Use for: laravel, eloquent, artisan, blade, php, sanctum, livewire, inertia, pest, phpunit, forge, vapor, queue, middleware, migration, factory, seeder.

Как установить скилл laravel-ops?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл laravel-ops запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить laravel-ops с