Skip to content

Instantly share code, notes, and snippets.

@jdavidbakr
Created May 22, 2015 17:14
Show Gist options
  • Save jdavidbakr/a054a6b959864e68f797 to your computer and use it in GitHub Desktop.
Save jdavidbakr/a054a6b959864e68f797 to your computer and use it in GitHub Desktop.
Laravel Blade: table
@if(!empty($table))
<table class='data'>
@foreach($table['rows'] as $row)
<?php
$row['attributes']['class'] = (!empty($row['attributes']['class']) ? $row['attributes']['class'] . ' ' : '') . $classes[$current_class];
$current_class = ($current_class + 1) % 2;
?>
<tr @if(!empty($row['attributes'])) @foreach($row['attributes'] as $key=>$value) {{ $key }}="{{ $value }}" @endforeach @endif >
@foreach($row['cells'] as $cell)
<{{ !empty($cell['dom']) ? $cell['dom'] : 'td' }} @if(!empty($cell['attributes'])) @foreach($cell['attributes'] as $key=>$value) {{ $key }}="{{ $value }}" @endforeach @endif >
{!! $cell['content'] !!}
</{{ !empty($cell['dom']) ? $cell['dom'] : 'td' }}>
@endforeach
</tr>
@endforeach
</table>
@if(!empty($table['links']))
{!! $table['links'] !!}
@endif
@endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment