Skip to content

Buttons and link

Lte3::btnSubmit(string $title, ?string $name = null, ?string $value = null, array $attrs = [])

A <button type="submit" class="btn btn-primary">. name and value are sent with the form, so one form can have several actions:

{!! Lte3::btnSubmit('Save', 'action', 'save') !!}
{!! Lte3::btnSubmit('Save and close', 'action', 'save-close', ['class' => 'btn-success']) !!}
return $request->input('action') === 'save-close'
? redirect()->route('admin.posts.index')
: back();
AttrTypeDescription
classstringAdded after btn btn-primary, e.g. btn-success (both classes stay, the later one in the CSS wins)
before_title, after_titlestringHTML around the title, e.g. an icon
confirmstringNative confirm() with this text before submit
disabledboolDisabled button
add'fixed'Also renders a round floating save button fixed in the corner of the screen, for long forms
any of view.field_attrsid, title, style, …

The title is HTML. The button has data-toggle="tooltip", so a title attribute shows a tooltip.

{!! Lte3::btnSubmit('Submit', null, null, ['before_title' => '<i class="fa fa-check"></i>', 'class' => 'btn-success']) !!}
{!! Lte3::btnSubmit('Save', 'action', 'save', ['add' => 'fixed']) !!}
Lte3::btnReset(string $title, array $attrs = [])

A link (<a class="btn btn-default">) to the current URL without the query string — resets a filter form.

AttrTypeDescription
urlstringTarget URL instead of the current one
ignoresarrayQuery parameters to keep: ['ignores' => ['per_page', 'sort']]
classstringExtra classes
confirmstringNative confirm() before following the link
disabledboolRenders the link without href
any of view.field_attrs
{!! Lte3::btnReset('Reset', ['ignores' => ['per_page']]) !!}
Lte3::btnModalClose(string $title, array $attrs = [])

A <button class="btn btn-default" data-dismiss="modal"> for modal footers. Attrs: class and view.field_attrs.

<div class="modal-footer">
{!! Lte3::btnModalClose('Cancel') !!}
{!! Lte3::btnSubmit('Save') !!}
</div>
Lte3::link(string $url, array $attrs = [])

A button-styled link in a form group, aligned with the fields of a form row: the label is both the link text and a reason to add an empty label line above it.

AttrTypeDefaultDescription
labelstringLink text
btn_classstringprimarybtn-<btn_class>
classstringExtra classes
targetstringtarget attribute
<div class="row">
<div class="col-md-4">{!! Lte3::text('sku') !!}</div>
<div class="col-md-2">{!! Lte3::link(route('admin.products.generate-sku'), ['label' => 'Generate', 'btn_class' => 'default']) !!}</div>
</div>