@@ -225,41 +225,42 @@ public function getCasts()
225
225
return $ this ->casts ;
226
226
}
227
227
228
+
228
229
/**
229
- * @inheritdoc
230
+ * Determine if the new and old values for a given key are equivalent.
231
+ *
232
+ * @param string $key
233
+ * @return bool
230
234
*/
231
- public function originalIsEquivalent ($ key, $ current )
235
+ public function originalIsEquivalent ($ key )
232
236
{
233
- if (!array_key_exists ($ key , $ this ->original )) {
237
+ if (! array_key_exists ($ key , $ this ->original )) {
234
238
return false ;
235
239
}
236
240
237
- $ original = $ this ->getOriginal ($ key );
241
+ $ attribute = Arr::get ($ this ->attributes , $ key );
242
+ $ original = Arr::get ($ this ->original , $ key );
238
243
239
- if ($ current === $ original ) {
244
+ if ($ attribute === $ original ) {
240
245
return true ;
241
- }
242
-
243
- if (null === $ current ) {
246
+ } elseif (is_null ($ attribute )) {
244
247
return false ;
245
- }
246
-
247
- if ($ this ->isDateAttribute ($ key )) {
248
- $ current = $ current instanceof UTCDateTime ? $ this ->asDateTime ($ current ) : $ current ;
248
+ } elseif ($ this ->isDateAttribute ($ key )) {
249
+ $ attribute = $ attribute instanceof UTCDateTime ? $ this ->asDateTime ($ attribute ) : $ attribute ;
249
250
$ original = $ original instanceof UTCDateTime ? $ this ->asDateTime ($ original ) : $ original ;
250
251
251
- return $ current == $ original ;
252
- }
253
-
254
- if ($ this ->hasCast ($ key )) {
255
- return $ this ->castAttribute ($ key , $ current ) ===
252
+ return $ attribute == $ original ;
253
+ } elseif ($ this ->hasCast ($ key , static ::$ primitiveCastTypes )) {
254
+ return $ this ->castAttribute ($ key , $ attribute ) ==
256
255
$ this ->castAttribute ($ key , $ original );
257
256
}
258
257
259
- return is_numeric ($ current ) && is_numeric ($ original )
260
- && strcmp ((string ) $ current , (string ) $ original ) === 0 ;
258
+ return is_numeric ($ attribute ) && is_numeric ($ original )
259
+ && strcmp ((string ) $ attribute , (string ) $ original ) === 0 ;
261
260
}
262
261
262
+
263
+
263
264
/**
264
265
* Remove one or more fields.
265
266
* @param mixed $columns
0 commit comments