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
Blade is the simple, yet powerful templating engine that is included with Laravel. Unlike some PHP templating engines, Blade does not restrict you from using plain PHP code in your templates.
Routing in Laravel allows you to route all your application requests to their appropriate controller. The main and primary routes in Laravel acknowledge and accept a URI (Uniform Resource Identifier) along with a closure, given that it should have to be a simple and expressive way of routing.
The blade templates are stored in the /resources/view directory. The main advantage of using the blade template is that we can create the master template, which can be extended by other files.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With