简体   繁体   English

在Laravel过滤器中单击“提交”按钮后,如何保持当前输入?

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

I am trying to get the old input after cilcking submit button using get method in laravel filter? 我试图在laravel过滤器中使用get方法点击提交按钮后获取旧输入? in my view 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="{{ 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() !!} 

and in my controller 在我的控制器中

           $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')); 

I cant get the old input value in my view file after clicking submit button.Please guide me, how to do it? 单击提交按钮后,无法在视图文件中获取旧的输入值。请指导我,该怎么做?

<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