@@ -201,32 +201,32 @@ public function getAttribute($key)
201
201
return parent ::getAttribute ($ key );
202
202
}
203
203
204
- /** @inheritdoc */
205
- protected function transformModelValue ($ key , $ value )
206
- {
207
- $ value = parent ::transformModelValue ($ key , $ value );
208
- if ($ this ->hasCast ($ key ) && $ value instanceof DateTimeInterface) {
209
- $ value ->settings (array_merge ($ value ->getSettings (), ['toStringFormat ' => $ this ->getDateFormat ()]));
210
-
211
- $ castType = $ this ->getCasts ()[$ key ];
212
- if ($ this ->isCustomDateTimeCast ($ castType ) && str_starts_with ($ castType , 'date: ' )) {
213
- $ value ->startOfDay ();
214
- }
215
- }
216
-
217
- return $ value ;
218
- }
219
-
220
- /** @inheritdoc */
221
- protected function getCastType ($ key )
222
- {
223
- $ castType = $ this ->getCasts ()[$ key ];
224
- if ($ this ->isCustomDateTimeCast ($ castType ) || $ this ->isImmutableCustomDateTimeCast ($ castType )) {
225
- $ this ->setDateFormat (Str::after ($ castType , ': ' ));
226
- }
227
-
228
- return parent ::getCastType ($ key );
229
- }
204
+ // /** @inheritdoc */
205
+ // protected function transformModelValue($key, $value)
206
+ // {
207
+ // $value = parent::transformModelValue($key, $value);
208
+ // if ($this->hasCast($key) && $value instanceof DateTimeInterface) {
209
+ // $value->settings(array_merge($value->getSettings(), ['toStringFormat' => $this->getDateFormat()]));
210
+ //
211
+ // $castType = $this->getCasts()[$key];
212
+ // if ($this->isCustomDateTimeCast($castType) && str_starts_with($castType, 'date:')) {
213
+ // $value->startOfDay();
214
+ // }
215
+ // }
216
+ //
217
+ // return $value;
218
+ // }
219
+
220
+ // /** @inheritdoc */
221
+ // protected function getCastType($key)
222
+ // {
223
+ // $castType = $this->getCasts()[$key];
224
+ // if ($this->isCustomDateTimeCast($castType) || $this->isImmutableCustomDateTimeCast($castType)) {
225
+ // $this->setDateFormat(Str::after($castType, ':'));
226
+ // }
227
+ //
228
+ // return parent::getCastType($key);
229
+ // }
230
230
231
231
/** @inheritdoc */
232
232
protected function getAttributeFromArray ($ key )
@@ -299,23 +299,23 @@ public function fromJson($value, $asObject = false)
299
299
return Json::decode ($ value ?? '' , ! $ asObject );
300
300
}
301
301
302
- /** @inheritdoc */
303
- protected function castAttribute ($ key , $ value )
304
- {
305
- $ castType = $ this ->getCastType ($ key );
306
-
307
- switch ($ castType ) {
308
- case 'immutable_custom_datetime ' :
309
- case 'immutable_datetime ' :
310
- if (str_starts_with ($ this ->getCasts ()[$ key ], 'immutable_date: ' )) {
311
- return $ this ->asDate ($ value )->toImmutable ();
312
- }
313
-
314
- return $ this ->asDateTime ($ value )->toImmutable ();
315
- default :
316
- return parent ::castAttribute ($ key , $ value );
317
- }
318
- }
302
+ // /** @inheritdoc */
303
+ // protected function castAttribute($key, $value)
304
+ // {
305
+ // $castType = $this->getCastType($key);
306
+ //
307
+ // switch ($castType) {
308
+ // case 'immutable_custom_datetime':
309
+ // case 'immutable_datetime':
310
+ // if (str_starts_with($this->getCasts()[$key], 'immutable_date:')) {
311
+ // return $this->asDate($value)->toImmutable();
312
+ // }
313
+ //
314
+ // return $this->asDateTime($value)->toImmutable();
315
+ // default:
316
+ // return parent::castAttribute($key, $value);
317
+ // }
318
+ // }
319
319
320
320
/** @inheritdoc */
321
321
public function attributesToArray ()
0 commit comments