Skip to content

Instantly share code, notes, and snippets.

@yankchina
Created June 27, 2016 16:03
Show Gist options
  • Save yankchina/ff5477467ef4541e2e27d1f65c1139a3 to your computer and use it in GitHub Desktop.
Save yankchina/ff5477467ef4541e2e27d1f65c1139a3 to your computer and use it in GitHub Desktop.
laravel 输出表格
<?php $cols=['title'=>'名称','meeting_group_title'=>'类型','meeting_current_person_number'=>'人数','meeting_max_person_number'=>'限额','meeting_registration_start_date'=>'开始报名','meeting_registration_end_date'=>'结束报名','meeting_start_date'=>'开始日期','meeting_end_date'=>'结束日期','status_code'=>'状态']; ?>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>
</th>
@foreach ($cols as $key=>$col)
<td>{{$col}}</td>
@endforeach
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach ($records as $index=>$record)
<tr>
<td>{{ ++$index }}</td>
@foreach ($cols as $key=>$col)
<td>{{$record -> $key}}</td>
@endforeach
<td>
<div class="btn-group btn-group-devided">
<a href="#edit" class="btn blue-hoki sbold" data-toggle="modal" id="{{$record -> id}}">编辑</a>
<a href="#" class="btn grey sbold">人员名单</a>
<a href="#" class="btn grey sbold">克隆</a>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
@yankchina
Copy link
Author

虽然不是很优雅,但也是一种很方便地输出数据表格的方式。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment