Lumen: getting an url parameter within a Blade view
NOTE: from the release of Lumen 5.2 views are no longer included with the framework since it is strongly focused on building stateless APIs. The code below works up to Lumen 5.1.
The following code can be used in Lumen, within a Blade view, in order to get the current value of a url parameter:
{{ app('request')->input('name') }}
Where name
is the url parameter name.
Example
Given the following url:
http://localhost:8000/example?company=netgloo
The following code:
{{ app('request')->input('company') }}
will print out the string “netgloo”.
References
http://laravel.com/api/5.0/Illuminate/Http/Request.html
http://stackoverflow.com/questions/30239296/howto-get-url-facade-in-lumen-blade-template
-
ori
-
Andrea
-