added validation on sub-admin
This commit is contained in:
@@ -82,10 +82,15 @@ class ManageSubAdminController extends Controller
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
// $principalType = Iam_Principal_Type::find($request->role_type);
|
||||
$alreadyExists = User::where('email',$request->email)->orWhere('contact_number',$request->contact_number)->exists();
|
||||
if($alreadyExists)
|
||||
$emailAlreadyExists = User::where('email',$request->email)->exists();
|
||||
$contactAlreadyExists = User::where('contact_number',$request->contact_number)->exists();
|
||||
if($emailAlreadyExists)
|
||||
{
|
||||
return response()->json(['status' => 400, 'message' =>'email or mobile number already exists']);
|
||||
return response()->json(['status' => 400, 'message' =>'email should be unique']);
|
||||
}
|
||||
if($contactAlreadyExists)
|
||||
{
|
||||
return response()->json(['status' => 400, 'message' =>'Mobile number should be unique']);
|
||||
}
|
||||
|
||||
// defining user type
|
||||
|
||||
Reference in New Issue
Block a user