소스 검색

添加是否是vip的属性

llp 3 달 전
부모
커밋
d5ce8ea175
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      packages/Webkul/Customer/src/Models/Customer.php

+ 11 - 0
packages/Webkul/Customer/src/Models/Customer.php

@@ -107,7 +107,18 @@ class Customer extends Authenticatable implements CustomerContract
     {
     {
         return ucfirst($this->first_name).' '.ucfirst($this->last_name);
         return ucfirst($this->first_name).' '.ucfirst($this->last_name);
     }
     }
+    /**
+     * Get the isVip.
+     */
+    public function getIsVipAttribute(): string
+    {
+        if (!$this->vip_expire_date) {
+            return false;
+        }
 
 
+        $expireDate = \Carbon\Carbon::parse($this->vip_expire_date);
+        return !$expireDate->isPast();
+    }
     /**
     /**
      * Get image url for the customer image.
      * Get image url for the customer image.
      *
      *