laravel get url in blade code example

Example 1: get current route in blade laravel

Get the current url

here using the Request::url() method. It will return the entire URL, but strip the query string from it.

<p> Url: {{  Request::url() }} </p>
Output

Url: http://localhost:8000/post/demo

Example 2: laravel use url

use Illuminate\Support\Facades\URL;

echo URL::current();

Example 3: laravel get a url using name

$url = route('routeName');

//if there is a param:
$url = route('routeName', ['id' => 1]);

https://laravel.com/docs/5.1/helpers#method-route

Example 4: get current route in blade laravel

Path: post/demo