Răsfoiți Sursa

fix: coupon type cannot display properly (#21)

pplulee 1 an în urmă
părinte
comite
f2bbafd764
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      src/Models/UserCoupon.php

+ 1 - 1
src/Models/UserCoupon.php

@@ -29,7 +29,7 @@ final class UserCoupon extends Model
      */
      */
     public function type(): string
     public function type(): string
     {
     {
-        return match (json_decode($this->content)) {
+        return match (json_decode($this->content)->type ?? null) {
             'percentage' => '百分比',
             'percentage' => '百分比',
             'fixed' => '固定金额',
             'fixed' => '固定金额',
             default => '未知',
             default => '未知',