22
33namespace MatanYadaev \EloquentSpatial \Traits ;
44
5- use Illuminate \Support \Arr ;
65use Illuminate \Support \Str ;
76use MatanYadaev \EloquentSpatial \Objects \GeometryCollection ;
87use MatanYadaev \EloquentSpatial \Objects \LineString ;
@@ -54,25 +53,6 @@ public function setRawAttributes(array $attributes, $sync = false): self
5453 return parent ::setRawAttributes ($ attributes , $ sync );
5554 }
5655
57- /**
58- * @inheritDoc
59- */
60- public function originalIsEquivalent ($ key ): bool
61- {
62- if (! array_key_exists ($ key , $ this ->original )) {
63- return false ;
64- }
65-
66- if ($ this ->isClassComparable ($ key )) {
67- $ attribute = Arr::get ($ this ->attributes , $ key );
68- $ original = Arr::get ($ this ->original , $ key );
69-
70- return $ this ->resolveCasterClass ($ key )->compare ($ attribute , $ original );
71- }
72-
73- return parent ::originalIsEquivalent ($ key );
74- }
75-
7656 /**
7757 * @return array
7858 */
@@ -88,33 +68,4 @@ private function getSpatialColumns(): array
8868
8969 return $ columns ;
9070 }
91-
92- /**
93- * Determine if an attribute can be checked for being dirty using a custom class.
94- *
95- * @param string $key
96- * @return bool
97- *
98- * @throws \Illuminate\Database\Eloquent\InvalidCastException
99- */
100- private function isClassComparable (string $ key ): bool
101- {
102- if ($ this ->isClassCastable ($ key )) {
103- $ castClass = $ this ->parseCasterClass ($ this ->getCasts ()[$ key ]);
104-
105- if (method_exists ($ castClass , 'compare ' )) {
106- return true ;
107- }
108-
109- if (method_exists ($ castClass , 'castUsing ' )) {
110- $ castClass = $ castClass ::castUsing ([]);
111-
112- if (method_exists ($ castClass , 'compare ' )) {
113- return true ;
114- }
115- }
116- }
117-
118- return false ;
119- }
12071}
0 commit comments