aBhijit
aBhijit

Reputation: 5361

Laravel - Get route by a route name

route('products.create') returns full path like http://myapp.dev/products/create.

How do I get the actual route? Only this -> products/create?

Upvotes: 1

Views: 50

Answers (1)

Kamran Ahmed
Kamran Ahmed

Reputation: 12438

There is no such functionality provided by Laravel at this point. However, you may try this:

$extra = URL::to('/');
$actual = route('products.create');
str_replace($extra, '', $actual);

That will remove the unnecessary base URL from your route URL.

Upvotes: 2

Related Questions