Local.ERROR:调用数组中的成员函数all()

时间:2018-08-14 10:30:37

标签: php laravel

我还不了解需要在代码中进行哪些修复以使其生成错误。什么是正确的?

这是代码:

public function addmember()
{
    try {
          $data = Input::all();

        $validator = Validator::make($data->all(),[
           'firstname'=>'required|min:2|max:20',
           'lastname'=>'required|min:2|max:20',
           'email'=>'required|email',
           'password'=>'required|min:6',
           'mobile_no'=>'required|numeric|min:10|max:10',
           'dob'=>'required|date'
          ]);
          if ($validator->fails()) {
            return response()->json(['errors'=>$validator->errors()]);
          }
          else{
          $firstName = $data['firstname'];
          $lastName = $data['lastname'];
          $email = $data['email'];
          $password = $data['password'];
          $mobile_number = $data['mobile_no'];
          $dob = $data['dob'];
          $query = "call insert_data_of_member_by_admin('$firstName','$lastName','$email','$password','$mobile_number','$dob');";
          $result= DB::select($query);
          return Response::json($result,200);
        }
   } catch (Exception $e) {

   }
}

1 个答案:

答案 0 :(得分:2)

let options = PHImageRequestOptions() 不是一个会生成错误的数组方法,因此请尝试将其从中删除:

all()

$validator = Validator::make($data->all(),[ __________________________________^^^^^^^ 已经是一个数组。