This repository was archived by the owner on Jan 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ class ActivityModel extends Model
11
11
'date_c ' => 'datetime ' ,
12
12
'date_d ' => 'date:Y ' ,
13
13
'date_e ' => 'datetime:Y-m ' ,
14
- 'date_f ' => 'immutable_date:Y ' ,
15
- 'date_g ' => 'immutable_datetime:Y-m ' ,
16
14
];
17
15
18
16
public $ dates = ['date_a ' ];
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public function it_supports_date_casts_and_custom_casts()
19
19
20
20
ActivityModel::unguard ();
21
21
22
- View::share ('model ' , new ActivityModel ([
22
+ View::share ('model ' , $ model = new ActivityModel ([
23
23
'date_a ' => now (),
24
24
'date_b ' => now (),
25
25
'date_c ' => now (),
@@ -29,6 +29,18 @@ public function it_supports_date_casts_and_custom_casts()
29
29
'date_g ' => now (),
30
30
]));
31
31
32
+ if (version_compare (app ()->version (), '8.53 ' , '>= ' )) {
33
+ $ model ->mergeCasts ([
34
+ 'date_f ' => 'immutable_date:Y ' ,
35
+ 'date_g ' => 'immutable_datetime:Y-m ' ,
36
+ ]);
37
+ } else {
38
+ $ model ->mergeCasts ([
39
+ 'date_f ' => 'date:Y ' ,
40
+ 'date_g ' => 'datetime:Y-m ' ,
41
+ ]);
42
+ }
43
+
32
44
$ this ->visit ('/date-time-casts ' )
33
45
->seeElement ('input[name="date_a"][value="2021-11-01T12:00:00.000000Z"] ' )
34
46
->seeElement ('input[name="date_b"][value="2021-11-01T00:00:00.000000Z"] ' )
You can’t perform that action at this time.
0 commit comments