簡體   English   中英

在Laravel過濾器中單擊“提交”按鈕后,如何保持當前輸入?

[英]How to keep the current input after clicking submit button in Laravel filter?

我試圖在laravel過濾器中使用get方法點擊提交按鈕后獲取舊輸入? 在我的視線中

 {!! 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="{{ Session::get('fullname') }}" class="form-control"/> </div> <div class="form-group col-md-4"><button class="btn btn-flat btn-primary">Search</button> </div>{!! Form::close() !!} 

在我的控制器中

           $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('jobseekers.created_at','DESC')->paginate(16);
        }       
       return view('backend.jobseekers.index',compact('jobseekers','result')); 

單擊提交按鈕后,無法在視圖文件中獲取舊的輸入值。請指導我,該怎么做?

<input type="text" name="fullname" placeholder="Name" value="{{ request()->input('fullname') }}" class="form-control"/>

您可以使用非常簡單的Laravel helper函數,它是old("fullname")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM