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
1111 'date_c ' => 'datetime ' ,
1212 'date_d ' => 'date:Y ' ,
1313 'date_e ' => 'datetime:Y-m ' ,
14- 'date_f ' => 'immutable_date:Y ' ,
15- 'date_g ' => 'immutable_datetime:Y-m ' ,
1614 ];
1715
1816 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()
1919
2020 ActivityModel::unguard ();
2121
22- View::share ('model ' , new ActivityModel ([
22+ View::share ('model ' , $ model = new ActivityModel ([
2323 'date_a ' => now (),
2424 'date_b ' => now (),
2525 'date_c ' => now (),
@@ -29,6 +29,18 @@ public function it_supports_date_casts_and_custom_casts()
2929 'date_g ' => now (),
3030 ]));
3131
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+
3244 $ this ->visit ('/date-time-casts ' )
3345 ->seeElement ('input[name="date_a"][value="2021-11-01T12:00:00.000000Z"] ' )
3446 ->seeElement ('input[name="date_b"][value="2021-11-01T00:00:00.000000Z"] ' )
You can’t perform that action at this time.
0 commit comments