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();