| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a38e420 commit 2298bf0
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2522,6 +2522,10 @@ public function attributesToArray() | |||
| 2522 | 2522 | $attributes[$key] = $this->castAttribute( | |
| 2523 | 2523 | $key, $attributes[$key] | |
| 2524 | 2524 | ); | |
| 2525 | + | ||
| 2526 | + if ($attributes[$key] && ($value === 'date' || $value === 'datetime')) { | ||
| 2527 | + $attributes[$key] = $this->serializeDate($attributes[$key]); | ||
| 2528 | + } | ||
| 2525 | 2529 | } | |
| 2526 | 2530 | ||
| 2527 | 2531 | // Here we will grab all of the appended, calculated attributes to this model | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1210,10 +1210,8 @@ public function testModelAttributesAreCastedWhenPresentInCastsArray() | |||
| 1210 | 1210 | $this->assertEquals($obj, $arr['objectAttribute']); | |
| 1211 | 1211 | $this->assertEquals(['foo' => 'bar'], $arr['arrayAttribute']); | |
| 1212 | 1212 | $this->assertEquals(['foo' => 'bar'], $arr['jsonAttribute']); | |
| 1213 | - $this->assertInstanceOf('Carbon\Carbon', $arr['dateAttribute']); | ||
| 1214 | - $this->assertInstanceOf('Carbon\Carbon', $arr['datetimeAttribute']); | ||
| 1215 | - $this->assertEquals('1969-07-20', $arr['dateAttribute']->toDateString()); | ||
| 1216 | - $this->assertEquals('1969-07-20 22:56:00', $arr['datetimeAttribute']->toDateTimeString()); | ||
| 1213 | + $this->assertEquals('1969-07-20 00:00:00', $arr['dateAttribute']); | ||
| 1214 | + $this->assertEquals('1969-07-20 22:56:00', $arr['datetimeAttribute']); | ||
| 1217 | 1215 | $this->assertEquals(-14173440, $arr['timestampAttribute']); | |
| 1218 | 1216 | } | |
| 1219 | 1217 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments