laravel:blade-components-and-layouts
Blade Components and Layouts
Encapsulate markup and behavior with components; prefer slots over includes.
Commands
sail artisan make:component Alert # or: php artisan make:component Alert
// Use component
<x-alert type="warning" :message="$msg" class="mb-4" />
// Layouts + stacks
@extends('layouts.app')
@push('scripts')
<script>/* page script */</script>
@endpush
Patterns
- Keep components dumb: pass data in, emit markup out
- Use
merge()to honor passed classes/attributes in components - Prefer named slots for readability
- Extract small, reusable atoms rather than giant organisms
More from jpcaparas/superpowers-laravel
laravel:routes-best-practices
Keep routes clean and focused on mapping requests to controllers; avoid business logic, validation, or database operations in route files
89laravel:quality-checks
Unified quality gates for Laravel projects; Pint, static analysis (PHPStan/Psalm), Insights (optional), and JS linters; Sail and non-Sail pairs provided
80laravel:performance-caching
Use framework caches and value/query caching to reduce work; add tags, locks, and explicit invalidation strategies for correctness
77laravel:eloquent-relationships
Define clear relationships and load data efficiently; prevent N+1, use constraints, counts/sums, and pivot syncing safely
76laravel:tdd-with-pest
Apply RED-GREEN-REFACTOR with Pest or PHPUnit; use factories, feature tests for HTTP, and parallel test runners; verify failures before implementation
76laravel:queues-and-horizon
Operate and verify queues with or without Horizon; safe worker flags, failure handling, and test strategies
75