search

Home  >  Q&A  >  body text

Why does my administrator edit and update successfully, but there is no Ajax prompt?

An error will be reported in TP5 debugging state

Undefined variable: data

public function editUser(Request $request)
{
//Get the data returned by the form
// $data = $request -> param();
$param = $request -> param();

//Remove the empty data in the form, that is, the data that has not been modified Content
      foreach ($param as $key => $value ){
          if (!empty($value)){
                                                                                                 #     }
          $condition = ['id'=>$data['id']] ; ;
                                                                                                                                                      ; ##        Session::set('user_info.role', $data['role']);
      }

                                                                        use   using   using     use using ’s ’ using using ’ s ’ through using ’s ’ through ‐ to ‐ ‐‐‐‐‐ and ​ to >
}
}

JerryJerry2573 days ago1340

reply all(2)I'll reply

  • 宇瞳

    宇瞳2018-05-09 20:28:15

    if($request->param('name')=='admin')
    {
    Session::set('user_info.role',$data['role']);
    }



    Change it to this

    reply
    0
  • 韦小宝

    韦小宝2018-02-01 16:47:06

    Define data at the front of the method and assign it to empty

    reply
    0
  • Jerry

    No, I am at the very beginning of the method, $data = null

    Jerry · 2018-02-01 16:52:29
  • Cancelreply