查询字符串验证Laravel

时间:2017-11-26 16:58:30

标签: php laravel

我不知道如何在Laravel验证中验证查询字符串数组。

这是我的代码

 public function addUserByAdmin(Request $request){
    $this->validate($request,[
        'name' => 'required',
        'fullname' => 'required',
        'password' => 'required',
        'position' => 'required',
        'phone' => 'required'
    ]);
        $uesrAction = new UserAction($this->repository);
        $user = $uesrAction->addUser($request->input('phone'),$request->input('password'),$request->input('name'),$request->input('fullname'),$request->input('position'));
        if($user){
            return response()->json(['success' => 'success','user'=>$user]);
        }
        return response()->json(['success' => 'fail']);
}

但验证不起作用。然后我尝试了Validation :: make()方法,但也无效。

我的网址就像

http://localhost:8000/admin/users/add-user?phone=abcdefg&password=erer&name=ere&fullname=rere&position=343

0 个答案:

没有答案