视图
<form action="{{url('navshow')}}" method="post">
<tr>
<td colspan="5">
<input type="submit" value="查询" class="btn" >
<input type="text" placeholder="请输入类名称" name="nav_name" style="margin-top:13px;">
</td>
</tr>
</form>
<tr>
<th>选择</th>
<th>导航id</th>
<!-- <th style="display: none;">是否警用</th> -->
<th>导航名称</th>
<th>导航分类</th>
<th>导航链接地址</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach($data as $v)
<tr>
<td><input type="checkbox" value="{{$v->id}}" name="box"></td>
<td>{{$v->id}}</td>
<td>@if(isset($v->level)){{{str_repeat(' -',$v->level)}}}@endif
{{$v->nav_name}}</td>
<td>{{$v->pid}}</td>
<td><a href="http://{{$v->nav_link}}">{{$v->nav_link}}</a></td>
<td><a href="navdel?id={{$v->id}}" class="btn btn-danger"><i class="icon-trash" style="margin-right:3px"> 删除</i></a></td>
</tr>
@endforeach
</tbody>
控制器
// 查询
public function navshow(){
$name = $_POST['nav_name'];
// 使用模糊查询
$data =DB::select("select * from hy_privileges where nav_name like '%{$name}%' ");
return view('nav.navindex',['data'=>$data]);
}