Add Class to html Macros Laravel Blade

Solution:

You can simply add an argument to your HTML Macro: (Obviously I don’t know how your macro looks like so this is just an example)

HTML::macro('clever_link', function($link, $label, $class = ''){
    return '<a href="'.$link.'" class="'.$class.'">'.$label.'</a>';
});

Usage:

{{ HTML::clever_link("index", 'Home', 'glow') }}

Or something a bit more flexible:

HTML::macro('clever_link', function($link, $label, $attributes = array()){
    return '<a href="'.$link.'" '.HTML::attributes($attributes).'>'.$label.'</a>';
});

Usage:

{{ HTML::clever_link("index", 'Home', array('class' => 'glow')) }}

(The HTML::attributes() method allows you to convert an array into an HTML attributes string)