fix validation error

This commit is contained in:
Jack Goh
2018-07-04 12:01:32 +08:00
parent 54f6722472
commit 232baf76cd
2 changed files with 6 additions and 11 deletions
@@ -64,15 +64,17 @@ class RegisterController extends Controller
$marking = Marking::Where('email',$data['email'])->first();
if(!$marking){
return response()->json('Does not exist ', 400);
return response()->json(["message"=>"Does not exist"], 400);
}
if($marking->marking != $data['marking']){
return response()->json('Incorrect marking', 400);
return response()->json(["message"=>"Incorrect marking"], 400);
}
if(User::Where('email',$data['email'])->first()){
return response()->json('Email already exist in the system', 400);
return response()->json(["message"=>"Email already exist in the system"], 400);
}
$role = Role::where('name','=','member')->first();
$user = new User();