File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 22
33All notable changes to ` laravel-settings ` will be documented in this file
44
5+ ## 2.1.10 - 2021-08-17
6+
7+ - add support for ` null ` in DateTime casts
8+
59## 2.1.9 - 2021-07-08
610
711- fix ` empty ` call not working when properties weren't loaded
Original file line number Diff line number Diff line change @@ -18,8 +18,12 @@ public function __construct(?string $type)
1818 $ this ->type = $ type ?? DateTime::class;
1919 }
2020
21- public function get ($ payload ): DateTimeInterface
21+ public function get ($ payload ): ? DateTimeInterface
2222 {
23+ if ($ payload === null ) {
24+ return null ;
25+ }
26+
2327 if ($ this ->type === Carbon::class) {
2428 return new Carbon ($ payload );
2529 }
@@ -42,10 +46,12 @@ public function get($payload): DateTimeInterface
4246 /**
4347 * @param DateTimeInterface $payload
4448 *
45- * @return string
49+ * @return null| string
4650 */
47- public function set ($ payload ): string
51+ public function set ($ payload ): ? string
4852 {
49- return $ payload ->format (DATE_ATOM );
53+ return $ payload !== null
54+ ? $ payload ->format (DATE_ATOM )
55+ : null ;
5056 }
5157}
You can’t perform that action at this time.
0 commit comments