diff --git a/src/Reactant/Models/Reactant.php b/src/Reactant/Models/Reactant.php index f44fdee..7b1eff0 100644 --- a/src/Reactant/Models/Reactant.php +++ b/src/Reactant/Models/Reactant.php @@ -48,7 +48,7 @@ final class Reactant extends Model implements public function id(): Attribute { - return Attribute::make( + return new Attribute( get: fn (string | null $value) => $value, set: fn (string | null $value) => $value, ); diff --git a/src/Reactant/ReactionCounter/Models/ReactionCounter.php b/src/Reactant/ReactionCounter/Models/ReactionCounter.php index 3c9b057..ba739d7 100644 --- a/src/Reactant/ReactionCounter/Models/ReactionCounter.php +++ b/src/Reactant/ReactionCounter/Models/ReactionCounter.php @@ -46,7 +46,7 @@ final class ReactionCounter extends Model implements public function count(): Attribute { - return Attribute::make( + return new Attribute( get: fn (int | null $value) => $value ?? self::COUNT_DEFAULT, set: fn (int | null $value) => $value ?? self::COUNT_DEFAULT, ); @@ -54,7 +54,7 @@ public function count(): Attribute public function weight(): Attribute { - return Attribute::make( + return new Attribute( get: fn (float | null $value) => $value ?? self::WEIGHT_DEFAULT, set: fn (float | null $value) => $value ?? self::WEIGHT_DEFAULT, ); diff --git a/src/Reactant/ReactionTotal/Models/ReactionTotal.php b/src/Reactant/ReactionTotal/Models/ReactionTotal.php index e745051..70c0138 100644 --- a/src/Reactant/ReactionTotal/Models/ReactionTotal.php +++ b/src/Reactant/ReactionTotal/Models/ReactionTotal.php @@ -44,7 +44,7 @@ final class ReactionTotal extends Model implements public function count(): Attribute { - return Attribute::make( + return new Attribute( get: fn (int | null $value) => $value ?? self::COUNT_DEFAULT, set: fn (int | null $value) => $value ?? self::COUNT_DEFAULT, ); @@ -52,7 +52,7 @@ public function count(): Attribute public function weight(): Attribute { - return Attribute::make( + return new Attribute( get: fn (float | null $value) => $value ?? self::WEIGHT_DEFAULT, set: fn (float | null $value) => $value ?? self::WEIGHT_DEFAULT, ); diff --git a/src/Reacter/Models/Reacter.php b/src/Reacter/Models/Reacter.php index 6400a32..69a7fb7 100644 --- a/src/Reacter/Models/Reacter.php +++ b/src/Reacter/Models/Reacter.php @@ -40,7 +40,7 @@ final class Reacter extends Model implements public function id(): Attribute { - return Attribute::make( + return new Attribute( get: fn (string | null $value) => $value, set: fn (string | null $value) => $value, ); diff --git a/src/Reaction/Models/Reaction.php b/src/Reaction/Models/Reaction.php index 14cdd58..c275135 100644 --- a/src/Reaction/Models/Reaction.php +++ b/src/Reaction/Models/Reaction.php @@ -49,7 +49,7 @@ final class Reaction extends Model implements public function id(): Attribute { - return Attribute::make( + return new Attribute( get: fn (string | null $value) => $value, set: fn (string | null $value) => $value, ); @@ -57,7 +57,7 @@ public function id(): Attribute public function rate(): Attribute { - return Attribute::make( + return new Attribute( get: fn (float | null $value) => $value ?? self::RATE_DEFAULT, set: function (float | null $value) { if ($value !== null && ($value < self::RATE_MIN || $value > self::RATE_MAX)) { diff --git a/src/ReactionType/Models/ReactionType.php b/src/ReactionType/Models/ReactionType.php index 6ee6ff3..a361f55 100644 --- a/src/ReactionType/Models/ReactionType.php +++ b/src/ReactionType/Models/ReactionType.php @@ -41,7 +41,7 @@ final class ReactionType extends Model implements public function id(): Attribute { - return Attribute::make( + return new Attribute( get: fn (string | null $value) => $value, set: fn (string | null $value) => $value, ); @@ -49,7 +49,7 @@ public function id(): Attribute public function mass(): Attribute { - return Attribute::make( + return new Attribute( get: fn (int | null $value) => $value ?? self::MASS_DEFAULT, set: fn (int | null $value) => $value ?? self::MASS_DEFAULT, );