1616 */
1717trait Identification
1818{
19- private const ID_RESOLVER_KEY = self ::class.':$idResolver ' ;
20-
21- private const TYPE_RESOLVER_KEY = self ::class.':$typeResolver ' ;
22-
2319 private string |null $ idCache = null ;
2420
2521 private string |null $ typeCache = null ;
@@ -35,7 +31,7 @@ trait Identification
3531 */
3632 public static function resolveIdUsing (callable $ callback )
3733 {
38- App::instance (self ::ID_RESOLVER_KEY , $ callback );
34+ App::instance (self ::class. ' :$idResolver ' , $ callback );
3935 }
4036
4137 /**
@@ -44,16 +40,16 @@ public static function resolveIdUsing(callable $callback)
4440 */
4541 public static function resolveTypeUsing (callable $ callback )
4642 {
47- App::instance (self ::TYPE_RESOLVER_KEY , $ callback );
43+ App::instance (self ::class. ' :$typeResolver ' , $ callback );
4844 }
4945
5046 /**
5147 * @return (callable(mixed, Request): string)
5248 */
5349 private static function idResolver ()
5450 {
55- if (! App::bound (self ::ID_RESOLVER_KEY )) {
56- return App::instance (self ::ID_RESOLVER_KEY , function (mixed $ resource , Request $ request ): string {
51+ if (! App::bound (self ::class. ' :$idResolver ' )) {
52+ return App::instance (self ::class. ' :$idResolver ' , function (mixed $ resource , Request $ request ): string {
5753 if (! $ resource instanceof Model) {
5854 throw ResourceIdentificationException::attemptingToDetermineIdFor ($ resource );
5955 }
@@ -65,16 +61,16 @@ private static function idResolver()
6561 });
6662 }
6763
68- return App::make (self ::ID_RESOLVER_KEY );
64+ return App::make (self ::class. ' :$idResolver ' );
6965 }
7066
7167 /**
7268 * @return (callable(mixed, Request): string)
7369 */
7470 private static function typeResolver ()
7571 {
76- if (! App::bound (self ::TYPE_RESOLVER_KEY )) {
77- return App::instance (self ::TYPE_RESOLVER_KEY , function (mixed $ resource , Request $ request ): string {
72+ if (! App::bound (self ::class. ' :$typeResolver ' )) {
73+ return App::instance (self ::class. ' :$typeResolver ' , function (mixed $ resource , Request $ request ): string {
7874 if (! $ resource instanceof Model) {
7975 throw ResourceIdentificationException::attemptingToDetermineTypeFor ($ resource );
8076 }
@@ -83,7 +79,7 @@ private static function typeResolver()
8379 });
8480 }
8581
86- return App::make (self ::TYPE_RESOLVER_KEY );
82+ return App::make (self ::class. ' :$typeResolver ' );
8783 }
8884
8985 /**
0 commit comments