2 years ago

After refresh go back

Posted 2 years ago by evripidesk

I have the below code that is search for security code (that is in my db) and I use form to search it, is working fine but if I hit the refresh button (browser) then I get back with the error , No record found how can I stop it and with the refresh get the normal details

 public function searchSecurityCode($id)
       $id = implode(',', $id);

       $security_code = Session::get('security_code');

       $this->validate(request(), [
           'q' => 'required'],
               'q.required'    => 'Please type the security code ',

            $q = Input::get ( 'q' );

            $success = Clients::where(function($query) use ($id,$q) {
                                          $query->where('id', 'LIKE', $id)
                                                  ->where('security_code', 'LIKE', $q);


            if(count($success) > 0) {
              $products = Products::with('user’,’clients’)->where(‘client_id','LIKE',$id)->paginate(10);
              $resetsecuritycode = Clients::find($id);
              $resetsecuritycode->security_code = str_random(10);

              return view(‘clients.history')->withClients($products);

            return redirect()->back()->with('status', 'No record founded!');


My route is below

Route::post('/clients/{id}/history/', '[email protected]');

Please sign in or create an account to participate in this conversation.