Skip to content
Advertisement

laravel 5.2 How to get route parameter in blade?

this is my url http://project.dev/blogs/image-with-article so, here I need the parameter image-with-article in my blade to display which is a parameter named slug here is in my routes file I need the slug paramter in blade.

JavaScript

Advertisement

Answer

I’m not sure what you mean. If you’re trying to construct the route in a Blade template, use

JavaScript

If you’re trying to access the given parameter, I would suggest passing it from the controller:

JavaScript

And if you really need to access the parameter from the view without first sending it from the controller… you really shouldn’t, but you can use the facade:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement