Lumen: get the full url containing the query string

In Lumen (the micro-framework by Laravel) the following code will return the full url containing also the query string:

public function someMethod(Request $request)
{ 
  // Get the full url
  $request->fullUrl();

  // 

}

This code works inside a controller where you can get the $request object.

Blade view

Inside a blade view can be used this:

{{ app('url')->full() }}

Laravel (using the URL facade)

On Laravel can be used also the URL facade:

URL::full()

References

http://laravel.com/api/5.0/Illuminate/Http/Request.html
http://laravel.com/docs/5.1/facades
http://stackoverflow.com/questions/30239296/howto-get-url-facade-in-lumen-blade-template

Categories

Category BootstrapCategory CoffeescriptCategory DrupalCategory GravCategory HTMLCategory JavascriptCategory JoomlaCategory jQueryCategory LaravelCategory MagentoCategory PHPCategory SharePointCategory SpringCategory ThymeleafCategory WordPressCategory Workflow

Comments

Developed and designed by Netgloo
© 2017 Netgloo