@@ -15,7 +15,7 @@ trait StateFusionInfo
15
15
public static function getStatesLabel ($ model ): array
16
16
{
17
17
return self ::getStateMapping ()->mapWithKeys (function ($ stateClass ) use ($ model ) {
18
- return [$ stateClass ::$ name => (new $ stateClass ($ model ))->getLabel () ?? $ stateClass ::$ name ];
18
+ return [$ stateClass ::getMorphClass () => (new $ stateClass ($ model ))->getLabel () ?? $ stateClass ::getMorphClass () ];
19
19
})->toArray ();
20
20
}
21
21
@@ -30,10 +30,10 @@ public static function getStatesColor($model): array
30
30
$ instance = new $ stateClass ($ model );
31
31
// Check if the class implements HasColor interface before calling getColor
32
32
if (method_exists ($ instance , 'getColor ' )) {
33
- return [$ stateClass ::$ name => $ instance ->getColor ()];
33
+ return [$ stateClass ::getMorphClass () => $ instance ->getColor ()];
34
34
}
35
35
36
- return [$ stateClass ::$ name => null ];
36
+ return [$ stateClass ::getMorphClass () => null ];
37
37
})->toArray ();
38
38
}
39
39
@@ -48,10 +48,10 @@ public static function getStatesDescription($model): array
48
48
$ instance = new $ stateClass ($ model );
49
49
// Check if the class implements HasDescription interface before calling getDescription
50
50
if (method_exists ($ instance , 'getDescription ' )) {
51
- return [$ stateClass ::$ name => $ instance ->getDescription ()];
51
+ return [$ stateClass ::getMorphClass () => $ instance ->getDescription ()];
52
52
}
53
53
54
- return [$ stateClass ::$ name => null ];
54
+ return [$ stateClass ::getMorphClass () => null ];
55
55
})->toArray ();
56
56
}
57
57
@@ -66,10 +66,10 @@ public static function getStatesIcon($model): array
66
66
$ instance = new $ stateClass ($ model );
67
67
// Check if the class implements HasIcon interface before calling getIcon
68
68
if (method_exists ($ instance , 'getIcon ' )) {
69
- return [$ stateClass ::$ name => $ instance ->getIcon ()];
69
+ return [$ stateClass ::getMorphClass () => $ instance ->getIcon ()];
70
70
}
71
71
72
- return [$ stateClass ::$ name => null ];
72
+ return [$ stateClass ::getMorphClass () => null ];
73
73
})->toArray ();
74
74
}
75
75
}
0 commit comments