laravel-expert
Laravel Expert — Gotchas & Decisions
Use Context7 for full Laravel docs.
Key Decisions
decisions[4]{choice,use_when}:
Form Request vs inline,"Form Request for reusable validation. Inline for one-off simple checks"
Service vs Action class,"Service for stateless business logic. Action (single __invoke) for discrete operations"
Event/Listener vs direct,"Events for decoupling (notifications/logging). Direct for tightly coupled ops"
Eloquent vs Query Builder,"Eloquent for domain models with relationships. Query Builder for reports/bulk ops"
Gotchas
- N+1: always
with()eager load. UsepreventLazyLoading()in AppServiceProvider to catch in dev readonlyDTOs (PHP 8.2+):readonly class UserData { public function __construct(public string $name) {} }updateOrCreateis NOT atomic — race condition possible. Use DB transaction for critical ops$model->save()returns bool, not the model — don't chain.Model::create()returns the model- Mass assignment:
$fillablewhitelist or$guarded = [](never use$guarded = []with user input) firstOrFail()throwsModelNotFoundException(404).first()returns null silently- Queue jobs: always implement
ShouldQueue. Without it, runs synchronously despitedispatch() Carbon::now()in tests: use$this->travel()orCarbon::setTestNow()for deterministic tests- Migrations: never edit a deployed migration. Create new migration for changes
More from nguyenthienthanh/aura-frog
stitch-design
Generate UI designs using Google Stitch AI with optimized prompts
36angular-expert
Angular 17+ gotchas and decision criteria. Covers signals vs observables, standalone patterns, and common pitfalls Claude gets wrong.
31flutter-expert
Flutter/Dart mobile expert. PROACTIVELY use when working with Flutter, Dart, mobile apps. Triggers: flutter, dart, widget, bloc, riverpod
16seo-expert
SEO and search engine optimization expert. PROACTIVELY use when working with meta tags, structured data, Core Web Vitals, sitemap, robots.txt, canonical URLs. Triggers: SEO, meta tags, schema markup, search ranking
13dev-expert
Development patterns for React, Vue, Laravel, Next.js, React Native - state management, forms, API integration
13react-native-expert
React Native best practices expert. PROACTIVELY use when working with React Native, mobile apps, Expo. Triggers: react-native, expo, mobile, iOS, Android, NativeWind
13