Vishal Shetty
Vishal Shetty

Reputation: 1668

How to create anchor tag in Laravel 5.1

I need help as I am trying to create anchor tag in Laravel 5.1

I used this line & this works

{!! Html::link('/dashboard','Dashboard') !!}

But I have code like this

<a href="#" class="logo">
  <span class="logo-mini"><b>cpy</b></span>
  <span class="logo-lg"><b>Company</b></span>
</a>

I want to fit above code into Laravel 5.1 link format , but i am unable to get it . Someone help me to sort out this.

Upvotes: 0

Views: 6434

Answers (1)

Kailaash Balachandran
Kailaash Balachandran

Reputation: 419

You can use URL or route to anchor element.

<a href="{{ URL::to('dashboard')}}" class="logo">
  <span class="logo-mini"><b>cpy</b></span>
  <span class="logo-lg"><b>Company</b></span>
</a>

This points to /dashboard. If you wish to suffix a parameter for example base-path/dashboard/user-name

then,

<a href="{{ URL::to('dashboard', $username)}}" class="logo">
      <span class="logo-mini"><b>cpy</b></span>
      <span class="logo-lg"><b>Company</b></span>
 </a>

When using URL, makes sure the path is set in routes.php

Upvotes: 4

Related Questions