How to Get base URL in Laravel

Here’s quick tip, which can be useful for generating the base or home URL within your Laravel application.

Must Read : How to Disable CSRF Middleware on Specific Routes in Laravel?

To get the base URL, use the following code,

{{ url('/') }}

If you are not using the Blade templating engine, you can simply echo to output the URL.

echo url('/');

 

3 Comments

Leave a Comment.