How to get the URI resource from a giving route name?

Posted 1 year ago by malhayek

I have a route named api.assets.v2.asset.show which is mapped to the following URI api/assets/v2/show/{asset}. I can see that info available in the php artisan route:list.

I am looking for a way to obtain the api/assets/v2/show/{asset} string when api.assets.v2.asset.show is giving.

In the ResourceRegistrar.php file https://github.com/drbyte/laravel-framework/blob/master/src/Illuminate/Routing/ResourceRegistrar.php#L123-L143 I can see a method called getResourceUri() which seems to be what I am looking for.

But, how can I call this method from inside my view?

I tried adding the following to my blade view {{ Route::getResourceUri('api.assets.v2.asset.show') }} But that is giving me the following error

Attribute [getResourceUri] does not exist.

Any idea on how to get the URI resource from a giving route name?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.