Support the ongoing development of Laravel.io →
posted 8 years ago
Views Blade
Last updated 2 years ago.
0

Either:

<a href="{{ $link-address }}">{{ $link-text }}</a>

Or, use Laravel's helper functions (https://laravel.com/docs/5.2/helpers):

{{ route($route-name) }}
{{ url($link-address) }}
0

thanks.

if I user these:

<a href="{{ $link-address }}">{{ $link-text }}</a>

Where do I initiate the value?

0

The simplest way is to pass the data into the view where you create it (whether that is in a controller, directly from routes.php, or otherwise).

For example:

return view('index.blade.php', ['link-address' => 'http://example.com', 'link-text' => 'Click Here']);

The array items which you pass to the view will be available within your view with the names of the array keys that you have defined (so in this case the variables $link-address and $link-text will be available to you).

0

@simonhunt thank you very much.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

osherdo osherdo Joined 26 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.