xslibx
xslibx

Reputation: 4349

How do I make a <div> link in laravel?

How do I make an entire div as a link in Laravel?

(using {{ link_to() }} does not work for me because I want an entire div to be clickable)

In traditional HTML I would link a div like the following

<a href="page.php">
    <div>
        ....
    </div>
</a>

How would I do this in Laravel? Assuming I want to link to page.blade.php and the route set up for page.blade.php is

Route::get('/page', function(){
    return View::make('page');
});

Upvotes: 1

Views: 3342

Answers (2)

lukasgeiter
lukasgeiter

Reputation: 152860

You can let Laravel generate the URL and write the rest of the HTML yourself

<a href="{{ URL::to('page') }}">
    <div></div>
</a>

Upvotes: 4

baao
baao

Reputation: 73231

You can do this with HTML::decode

{{ HTML::decode(link_to('page','<div>....</div>')) }}

Upvotes: 4

Related Questions