选择过滤器后,我想显示我们选择的摘要选项卡/消息。 我用谷歌搜索并找到了 session 方法,它适合我的情况吗? 这是我的 Blade
{!! Form::open(['url'=>'/jobseekers','method'=>'GET', 'class'=>'form', 'id'=>'search_data']) !!}
<div class="form-group col-md-4">
<input type="text" name="fullname" placeholder="Name" value="{{ request()->input('fullname')}}" class="form-control"/>
</div>
<div class="form-group col-md-4">
<input type="text" name="fb_name" placeholder="Fb Name" value="{{ request()->input('fb_name')}}" class="form-control"/>
</div>
<button class="btn btn-flat btn-primary">Search</button>
</div>
{!! Form::close() !!}
在我的 Controller 中
public function index(Request $request)
{
$result = null;
if(count($request->all())!=0){
if ($request->has('sub_search')) {
$jobseekers = Jobseeker::Subsearch($request)->paginate(10);
dd($applicant_information);
}else{
$result=Jobseeker::Search($request)->paginate(10);
// dd($orders);
}
}
else{
$jobseekers = Jobseeker::with('calllogs')->orderBy('created_at', 'desc')->paginate(16);
}
return view('backend.jobseekers.index',compact('jobseekers','result'));
}
我正在使用 get 方法来过滤,我想显示为
The Search results for fullname and fb_name are:
对于我的情况,有什么办法可以做到这一点吗?请指导我,谢谢。
最佳答案
您是否尝试在 View 中显示过滤结果?如果是这样,请将您的代码更改为:-
public function index(Request $request)
{
$fullname = $request->fullname;
$fb_name= $request->fb_name;
$result = null;
if(count($request->all())!=0){
if ($request->has('sub_search')) {
$jobseekers = Jobseeker::Subsearch($request)->paginate(10);
dd($applicant_information);
}else{
$result=Jobseeker::Search($request)->paginate(10);
// dd($orders);
}
}
else{
$jobseekers = Jobseeker::with('calllogs')->orderBy('created_at', 'desc')->paginate(16);
}
return view('backend.jobseekers.index',compact('jobseekers','result'))->with('fullname',$fullname)->with('fb_name',$fb_name);
}
您所需要做的就是从该 Controller 访问传递的变量,就像
{{$fullname}} 和 {{$fb_name}} 的搜索结果为:
并在此处循环结果...
关于php - 如何在 Laravel 中过滤后显示消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45530188/