2017-08-06 62 views
2

選擇過濾器後,我想顯示摘要選項卡/消息我們選擇了什麼。 我GOOGLE了它,發現會話方法,它適合我的情況? 這裏是我的刀片如何在laravel中顯示過濾器後的消息?

{!! 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() !!}

,並在我的控制器

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方法來過濾,和我想告訴喜歡

全稱fb_name的搜索結果是:

有沒有辦法做到像我的情況?請指導我,謝謝。

回答

3

您是否試圖在視圖中顯示過濾結果?如果是這樣,你的代碼更改爲: -

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); 
    } 


所有你需要從該控制器就像是

的搜索結果{{$全稱}}和{{訪問傳遞的變量$ fb_name}}爲:

並循環你的結果在這裏...

+0

非常感謝bro,它的工作原理。 –

+0

歡迎兄弟:)高興地幫助 – pandesantos