Vojta
Vojta

Reputation: 379

Link in laravel blade template

I'm struggling to create link in blade template in Laravel. I will pass the URL in template from environment variable.

The output suppose to be like.

<a href="https://google.com">Visit Google</a>

I am trying sth like this but with no luck.

<a href="{{env('APP_URL')}}">Visit my site</a>

Laravel Framework 5.5.19

Thank you

Upvotes: 10

Views: 36215

Answers (1)

kerrin
kerrin

Reputation: 3452

Use the Laravel helper url()

For a link to the home page: <a href="{{ url('/') }}">Visit Google</a>

From Laravel docs: https://laravel.com/docs/5.5/helpers#method-url

Upvotes: 15

Related Questions