Ken 1 day ago
parent
commit
d9a6c3d5f3
1 changed files with 8 additions and 0 deletions
  1. 8 0
      app/Models/User.php

+ 8 - 0
app/Models/User.php

@@ -2,6 +2,8 @@
 
 namespace App\Models;
 
+use Carbon\Carbon;
+
 /**
  * @property int $id
  * @property string $member_id
@@ -22,6 +24,12 @@ class User extends BaseModel
     ];
     protected $hidden = ['updated_at'];
 
+
+    function getCreatedAtAttribute($value): string
+    {
+        return Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d');
+    }
+
     public function wallet()
     {
         return $this->belongsTo(Wallet::class, 'id', 'user_id');