*/ protected function uuid(): Attribute { return Attribute::make( get: function (?string $value, array $attributes) { if (! isset($attributes['uuid'])) { return tap($this->newUniqueId(), function ($uuid) { $this->forceFill(['uuid' => $uuid]); }); } return $attributes['uuid']; }, set: fn (string $value) => $this->isValidUniqueId($value) ? $value : null, )->shouldCache(); } }