Problem
You want to generate a link to one of your routes.
Solution
Use the HTML::linkRoute()
method.
The only required argument is the first one, the name of the route.
{{ HTML::linkRoute('login') }}
Depending on your app/routes.php
file, this may output something like.
<a href="https://ift.tt/1nUOzoY">http://your.url/user/login</a>
If you don’t have a route with the name specified, an error will get generated.
You can pass a second argument to specify the title to display.
{{ HTML::linkRoute('login', 'Sign In') }}
This produces something similar to the following (based on routes.php).
<a href="https://ift.tt/1nUOzoY">Sign In</a>
If you’re route takes parameters, then you must pass a third argument.
The output could look something like below.
<a href="http://your.url/items/4">Show item #4</a>
You can specify an array as the fourth parameter. This array should contain any additional attributes to apply to the anchor tag.
Now the anchor tag has a class attribute.
<a href="https://ift.tt/1nUOzoY" class="btn">Sign In</a>
Discussion
Nothing to discuss.
from Linux Hint https://ift.tt/3gwXhcL
0 Comments