Laravel-文本输入搜索不适用于按钮单击
我正在创建一个搜索条件,点击按钮时输入的文本将显示在表td上的结果。没有任何更改,也没有显示错误消息 我已经编写了控制器和视图 控制器Laravel-文本输入搜索不适用于按钮单击,laravel,Laravel,我正在创建一个搜索条件,点击按钮时输入的文本将显示在表td上的结果。没有任何更改,也没有显示错误消息 我已经编写了控制器和视图 控制器 public function playersPerGame() { $data['title'] = 'Games Report'; $games= GamePoint::select('game_point.game_name','game_point.description','game_po
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'])}
{Form::text('game_name',null,['class'=>'Form-control','placeholder'=>'game name'])}
{{Form::submit('Search',['class'=>'btn btn warning'])}
{{Form::close()}}
@if(会话::has('flash_message'))
{{Session::get('flash_message')}
@恩迪夫
@如果(计算($游戏))
#
游戏
描述
指定的点
上载日期
@foreach($key=>$gaming的游戏)
{{++$key}
{{$gaming->game_name}
{{$gaming->description}
{{$gaming->point_assigned}
{{$gaming->created_at}
@endforeach
单击按钮时,我希望它显示基于文本输入的结果,但什么也没发生我自己解决了它。我忘记添加(请求$Request)。谢谢删除您的帖子
{{ 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