Search code examples
phptwitter-bootstraplaravellaravelcollective

Laravel Collective Form and Custom Bootstrap component


I have this submit button in my view,using Laravel Collective package:

{!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}

and as you can see it add a Bootstrap class and create a button.

Now my purpose is to create a custom button like this:

<button type="button" class="btn btn-default btn-lg">
    <span class="glyphicon glyphicon-star" aria-hidden="true"></span> Star
</button>

that has a span to keep the glyphicon. How could I do that?


Solution

  • You need to create a custom macro to achieve this.

    https://laravelcollective.com/docs/master/html#custom-macros

    Unless you're planning to reuse it a lot, you'd be better of creating a partial instead.