Byproduct of the Laravel 13 upgrade: composer's post-update-cmd runs `artisan boost:update`, and Boost went 2.1.3 to 2.4.x with the update. Refreshes CLAUDE.md and boost.json for the Laravel 13 / Livewire 4 stack, updates the livewire, pest and tailwindcss skills, replaces the developing-with-fortify skill with fortify-development, and adds new laravel-best-practices and octane-development skills. Generated output, not hand-edited. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1.2 KiB
Mail Best Practices
Implement ShouldQueue on the Mailable Class
Makes queueing the default regardless of how the mailable is dispatched. No need to remember Mail::queue() at every call site — Mail::send() also queues it.
Use afterCommit() on Mailables Inside Transactions
A queued mailable dispatched inside a transaction may process before the commit. Use $this->afterCommit() in the constructor.
Use assertQueued() Not assertSent() for Queued Mailables
Mail::assertSent() only catches synchronous mail. Queued mailables fail assertSent with a "Did you mean to use assertQueued()?" hint.
Incorrect: Mail::assertSent(OrderShipped::class); when mailable implements ShouldQueue.
Correct: Mail::assertQueued(OrderShipped::class);
Use Markdown Mailables for Transactional Emails
Markdown mailables auto-generate both HTML and plain-text versions, use responsive components, and allow global style customization. Generate with --markdown flag.
Separate Content Tests from Sending Tests
Content tests: instantiate the mailable directly, call assertSeeInHtml().
Sending tests: use Mail::fake() and assertSent()/assertQueued().
Don't mix them — it conflates concerns and makes tests brittle.