当我尝试通过邮递员fname,lname,bio,fb_token发送请求时,它会给我error{"frist_name":["The frist name field is required."]
这是代码:
public function store()
{
if(User::where('fb_id','=',\Input::get('fb_id'))->exists())
{
$user = array(
'fb_id' => Input::get('fb_id'),
'fb_token' => Input::get('fb_token')
);
if (\Auth::attempt($user)) {
echo 'found';
} else {
echo 'try log in again';
}
}
else {
$validation = \Validator::make(
Request::all(), array(
'frist_name' => 'required|alpha',
'last_name' => 'required|alpha',
'fb_id' => 'required|unique:user',
'user_name' => 'required|unique:user',
'bio' => 'max:140',
'fb_token' => 'required|unique:user'
));
$f=Request::get('frist_name');
if ($validation->passes()) {
$newUser = new User();
$newUser->user_name = Request::get('user_name');
$newUser->frist_name = Request::get('frist_name');
$newUser->last_name = Request::get('last_name');
$newUser->fb_id = Request::get('fb_id');
$newUser->fb_token = Request::get('fb_token');
$newUser->profile_pic = Request::get('profile_pic');
$newUser->bio = Request::get('bio');
$newUser->save();
} else {
$error = $validation->messages();
return \Response::json($error);
} }
}