Skip to content

Instantly share code, notes, and snippets.

@kauhat
Last active May 10, 2017 20:41
Show Gist options
  • Save kauhat/8f0021ea17a8965efc98ab5a82f80aa1 to your computer and use it in GitHub Desktop.
Save kauhat/8f0021ea17a8965efc98ab5a82f80aa1 to your computer and use it in GitHub Desktop.
Laravel 5.4+ Bootstrap 3 panel component
@component('panel')
@slot('title')
Example
@endslot
{{-- Buttons and input inside 'panel-heading' --}}
@slot('actions')
<a class="btn btn-default" href="#">Create</a>
@endslot
{{-- Uncontained content will be placed inside a `panel-body` element --}}
<p>Hello!</p>
{{-- Full width content can go here --}}
@slot('table')
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<td></td>
<td></td>
<td></td>
</tbody>
</table>
@endslot
@slot('footer')
<a class="btn btn-primary pull-right" href="#">Submit</a>
@endslot
@endcomponent
<div class="panel panel-default {{ $class or '' }}">
@if (isset($title) || isset($actions))
<div class="panel-heading clearfix">
@if (isset($actions))
<div class="pull-right">
{{ $actions }}
</div>
@endif
@if (isset($title))
<h3 class="panel-title">{{ $title }}</h3>
@endif
</div>
@endif
@if (isset($slot) && !empty($slot->toHtml()))
<div class="panel-body">
{{ $slot }}
</div>
@endif
@if (isset($table))
{{ $table }}
@endif
@if (isset($footer))
<div class="panel-footer clearfix">
{{ $footer }}
</div>
@endif
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment