我正在创建一个搜索条件,单击按钮时输入的文本将把结果显示在表td上。没有任何变化,没有错误消息显示
我已经写好了控制器并查看了
控制器
public function playersPerGame()
{
$data['title'] = 'Games Report';
$games= GamePoint::select('game_point.game_name','game_point.description','game_point.point_assigned','game_point.created_at');
$render=[];
if(isset($request->game_name))
{
$games=$games->where('game_name','like','%'.$request->game_name.'%');
$render['name']=$request->name;
}
$games= $games->paginate(15);
$games= $games->appends($render);
$data['games'] = $games;
return view('report.playersPerGame',$data); //
}
查看
{{ Form::model(request(),['method'=>'get']) }}
<div class="col-sm-4">
{{ Form::text('game_name',null,['class'=>'form-control','placeholder'=>'Game name']) }}
</div>
<div class="col-sm-4">
</div>
<div class="col-sm-4">
{{ Form::submit('Search',['class'=>'btn btn-warning']) }}
<a href="" class="btn btn-info">Export</a>
</div>
{{ Form::close() }}
</div>
<div class="box box-primary">
<div class="box-header with-border">
@if(Session::has('flash_message'))
<div class="alert alert-success">
{{ Session::get('flash_message') }}
</div>
@endif
@if(count($games))
<table class="table table-bordered table-hover table-striped table-condesed" id="game_info_table">
<caption></caption>
<thead>
<tr>
<td>#</td>
<td>Games</td>
<td>Description</td>
<td>Point Assigned</td>
<td>Date Uploaded</td>
</tr>
</thead>
<tbody>
@foreach($games as $key => $gaming)
<tr>
<td>{{ ++$key }}</td>
<td>{{ $gaming->game_name }}</td>
<td>{{ $gaming->description }}</td>
<td>{{ $gaming->point_assigned }}</td>
<td>{{ $gaming->created_at }}</td>
</tr>
@endforeach
单击按钮时,我希望它显示基于文本输入的结果,但是什么也没发生
答案 0 :(得分:-1)
我自己解决了。我忘记添加(请求$ request)。谢谢