Ken 1 hete
szülő
commit
f475bf17b5
2 módosított fájl, 37 hozzáadás és 15 törlés
  1. 2 15
      app/Models/Bank.php
  2. 35 0
      app/Models/BaseModel.php

+ 2 - 15
app/Models/Bank.php

@@ -21,12 +21,11 @@ use Laravel\Sanctum\HasApiTokens;
  * @property $alias
  *
  */
-class Bank extends Authenticatable
+class Bank extends BaseModel
 {
-    use HasApiTokens, Notifiable;
+
 
     protected $table = 'banks';
-    protected $hidden = ['created_at', 'updated_at'];
     protected $fillable = ['member_id', 'channel', 'bank_name', 'account', 'card_no', 'alias'];
 
     public function getId()
@@ -69,16 +68,4 @@ class Bank extends Authenticatable
     {
         return $this->card_no;
     }
-
-
-    protected function getCreatedAtAttribute($value)
-    {
-        return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
-    }
-
-    protected function getUpdatedAtAttribute($value)
-    {
-        return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
-    }
-
 }

+ 35 - 0
app/Models/BaseModel.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Foundation\Auth\User as Authenticatable;
+use Illuminate\Notifications\Notifiable;
+use Laravel\Sanctum\HasApiTokens;
+use Carbon\Carbon;
+
+/**
+ * Admin
+ * @mixin Builder
+ * @method static Builder|static where($column, $operator = null, $value = null, $boolean = 'and')
+ * @method static Builder|static create($data)
+ *
+ */
+class BaseModel extends Authenticatable
+{
+    use HasApiTokens, Notifiable;
+
+    protected $table = '';
+    protected $hidden = ['created_at', 'updated_at'];
+    protected $fillable = [];
+
+    protected function getCreatedAtAttribute($value)
+    {
+        return Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
+    }
+
+    protected function getUpdatedAtAttribute($value)
+    {
+        return Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
+    }
+}