回答編集履歴

2

修正

2020/01/26 03:28

投稿

退会済みユーザー
test CHANGED
@@ -8,11 +8,21 @@
8
8
 
9
9
  protected $dates = [
10
10
 
11
- 'purchase_time' => 'Y-m-d',
11
+ 'purchase_time',
12
12
 
13
-      'last_time' => 'Y-m-d'
13
+      'last_time'
14
14
 
15
15
  ];
16
+
17
+
18
+
19
+ protected $casts = [
20
+
21
+ 'purchase_time' => 'datetime:Y-m-d',
22
+
23
+ ];
24
+
25
+
16
26
 
17
27
  }
18
28
 
@@ -23,3 +33,5 @@
23
33
 
24
34
 
25
35
  こう言う方法もある
36
+
37
+ https://readouble.com/laravel/6.x/ja/eloquent-mutators.html

1

修正

2020/01/26 03:28

投稿

退会済みユーザー
test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  'purchase_time' => 'Y-m-d',
12
12
 
13
-      'last_time'' => 'Y-m-d'
13
+      'last_time' => 'Y-m-d'
14
14
 
15
15
  ];
16
16