diff --git a/laravel/routing/route.php b/laravel/routing/route.php index 0b816300..75c66253 100644 --- a/laravel/routing/route.php +++ b/laravel/routing/route.php @@ -218,4 +218,20 @@ public function handles($uri) })); } + /** + * Extract the URI string from a route destination. + * + * + * // Returns "home/index" as the destination's URI + * $uri = Route::uri('GET /home/index'); + * + * + * @param string $destination + * @return string + */ + public static function destination($destination) + { + return trim(substr($destination, strpos($destination, '/')), '/') ?: '/'; + } + } \ No newline at end of file