@@ -1078,8 +1078,8 @@ public function reverseRoute(string $search, ...$params)
1078
1078
// all routes to find a match.
1079
1079
foreach ($ this ->routes as $ collection ) {
1080
1080
foreach ($ collection as $ route ) {
1081
- $ from = key ($ route ['route ' ]);
1082
- $ to = $ route ['route ' ][$ from ];
1081
+ $ routeKey = key ($ route ['route ' ]);
1082
+ $ to = $ route ['route ' ][$ routeKey ];
1083
1083
1084
1084
// ignore closures
1085
1085
if (! is_string ($ to )) {
@@ -1103,7 +1103,7 @@ public function reverseRoute(string $search, ...$params)
1103
1103
continue ;
1104
1104
}
1105
1105
1106
- return $ this ->buildReverseRoute ($ from , $ params );
1106
+ return $ this ->buildReverseRoute ($ routeKey , $ params );
1107
1107
}
1108
1108
}
1109
1109
@@ -1218,21 +1218,21 @@ protected function fillRouteParams(string $from, ?array $params = null): string
1218
1218
* @param array $params One or more parameters to be passed to the route.
1219
1219
* The last parameter allows you to set the locale.
1220
1220
*/
1221
- protected function buildReverseRoute (string $ from , array $ params ): string
1221
+ protected function buildReverseRoute (string $ routeKey , array $ params ): string
1222
1222
{
1223
1223
$ locale = null ;
1224
1224
1225
1225
// Find all of our back-references in the original route
1226
- preg_match_all ('/\(([^)]+)\)/ ' , $ from , $ matches );
1226
+ preg_match_all ('/\(([^)]+)\)/ ' , $ routeKey , $ matches );
1227
1227
1228
1228
if (empty ($ matches [0 ])) {
1229
- if (strpos ($ from , '{locale} ' ) !== false ) {
1229
+ if (strpos ($ routeKey , '{locale} ' ) !== false ) {
1230
1230
$ locale = $ params [0 ] ?? null ;
1231
1231
}
1232
1232
1233
- $ from = $ this ->replaceLocale ($ from , $ locale );
1233
+ $ routeKey = $ this ->replaceLocale ($ routeKey , $ locale );
1234
1234
1235
- return '/ ' . ltrim ($ from , '/ ' );
1235
+ return '/ ' . ltrim ($ routeKey , '/ ' );
1236
1236
}
1237
1237
1238
1238
// Locale is passed?
@@ -1250,13 +1250,13 @@ protected function buildReverseRoute(string $from, array $params): string
1250
1250
1251
1251
// Ensure that the param we're inserting matches
1252
1252
// the expected param type.
1253
- $ pos = strpos ($ from , $ pattern );
1254
- $ from = substr_replace ($ from , $ params [$ index ], $ pos , strlen ($ pattern ));
1253
+ $ pos = strpos ($ routeKey , $ pattern );
1254
+ $ routeKey = substr_replace ($ routeKey , $ params [$ index ], $ pos , strlen ($ pattern ));
1255
1255
}
1256
1256
1257
- $ from = $ this ->replaceLocale ($ from , $ locale );
1257
+ $ routeKey = $ this ->replaceLocale ($ routeKey , $ locale );
1258
1258
1259
- return '/ ' . ltrim ($ from , '/ ' );
1259
+ return '/ ' . ltrim ($ routeKey , '/ ' );
1260
1260
}
1261
1261
1262
1262
/**
0 commit comments