소스 검색

Convert deprecated `$dates` property to `$casts`

Shift 2 년 전
부모
커밋
e947abcab2
3개의 변경된 파일7개의 추가작업 그리고 11개의 파일을 삭제
  1. 3 2
      app/Models/ApplicationApi.php
  2. 2 2
      app/Models/Server.php
  3. 2 7
      app/Models/Voucher.php

+ 3 - 2
app/Models/ApplicationApi.php

@@ -15,8 +15,9 @@ class ApplicationApi extends Model
     protected $primaryKey = 'token';
 
     public $incrementing = false;
-
-    protected $dates = ['last_used'];
+    protected $casts = [
+        'last_used' => 'datetime',
+    ];
 
     public static function boot()
     {

+ 2 - 2
app/Models/Server.php

@@ -51,8 +51,8 @@ class Server extends Model
     /**
      * @var string[]
      */
-    protected $dates = [
-        'suspended',
+    protected $casts = [
+        'suspended' => 'datetime',
     ];
 
     public static function boot()

+ 2 - 7
app/Models/Voucher.php

@@ -25,20 +25,15 @@ class Voucher extends Model
         'uses',
         'expires_at',
     ];
-
-    protected $dates = [
-        'expires_at',
-    ];
-
     /**
      * The attributes that should be cast to native types.
      *
      * @var array
      */
     protected $casts = [
+        'expires_at' => 'datetime',
         'credits' => 'float',
-        'uses' => 'integer',
-    ];
+        'uses' => 'integer',    ];
 
     protected $appends = ['used', 'status'];