From c642090d970bdfb423637418d1950f95c45a6a4f Mon Sep 17 00:00:00 2001 From: nexxo Date: Mon, 27 Jul 2026 21:28:23 +0200 Subject: [PATCH] Point the mailbox model at the UUID trait the repo already has Seventeen models use App\Models\Concerns\HasUuid, and R11 is the reason: URLs address records by UUID, not by integer primary key. The plan told the implementer to hand-roll booted() instead, losing getRouteKeyName() with it. Authoring error, corrected before the remaining tasks copy it. --- docs/superpowers/plans/2026-07-27-mailboxes.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/docs/superpowers/plans/2026-07-27-mailboxes.md b/docs/superpowers/plans/2026-07-27-mailboxes.md index 49b4886..d243c11 100644 --- a/docs/superpowers/plans/2026-07-27-mailboxes.md +++ b/docs/superpowers/plans/2026-07-27-mailboxes.md @@ -359,10 +359,10 @@ return new class extends Migration namespace App\Models; +use App\Models\Concerns\HasUuid; use App\Services\Secrets\SecretCipher; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Str; /** * One sending address. @@ -373,7 +373,10 @@ use Illuminate\Support\Str; */ class Mailbox extends Model { - use HasFactory; + // HasUuid assigns the uuid on create AND makes it the route key — R11: + // URLs address records by UUID, not by integer primary key. Seventeen + // models already use it; do not hand-roll a booted() replacement. + use HasFactory, HasUuid; protected $fillable = [ 'key', 'address', 'display_name', 'username', @@ -389,13 +392,6 @@ class Mailbox extends Model ]; } - protected static function booted(): void - { - static::creating(function (self $box) { - $box->uuid ??= (string) Str::uuid(); - }); - } - public static function findByKey(string $key): ?self { return static::query()->where('key', $key)->first();