public function registerUser(Request $request) { $messge = array("status" => 0); if (isset($_REQUEST['firstName']) && !empty($_REQUEST['firstName'])) { $firstName = $_REQUEST['firstName']; } if (isset($_REQUEST['lastName']) && !empty($_REQUEST['lastName'])) { $lastName = $_REQUEST['lastName']; } if (isset($_REQUEST['userName']) && !empty($_REQUEST['userName'])) { $userName = $_REQUEST['userName']; } if (isset($_REQUEST['Password']) && !empty($_REQUEST['Password'])) { $Password = md5($_REQUEST['Password']); } if (isset($_REQUEST['DOB']) && !empty($_REQUEST['DOB'])) { $DOB = $_REQUEST['DOB']; } if (isset($_REQUEST['phone']) && !empty($_REQUEST['phone'])) { $Phone = $_REQUEST['phone']; } if (isset($_REQUEST['Email']) && !empty($_REQUEST['Email'])) { $Email = $_REQUEST['Email']; } if (isset($_REQUEST['address']) && !empty($_REQUEST['address'])) { $Address = $_REQUEST['address']; } if (isset($_REQUEST['postalCode']) && !empty($_REQUEST['postalCode'])) { $PostalCode = $_REQUEST['postalCode']; } $Gender = $_REQUEST['rdbGender']; $Country = $_REQUEST['country']; $memberType = $_REQUEST['userType']; if ($memberType == 'Tenant') { $users = DB::table('tbltenant')->select(DB::raw('*'))->where('UserName', '=', $userName)->orWhere('Email', '=', $Email)->get(); $user1 = DB::table('tbllandlord')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); $user2 = DB::table('tblvehicleowner')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); if (!empty($users) or !empty($user1) or !empty($user2)) { $messge['status'] = -1; $messge['msg'] = "User name or Password already exist"; } else { $user = User::create(['FirstName' => $firstName, 'LastName' => $lastName, 'UserName' => $userName, 'Password' => $Password, 'DOB' => $DOB, 'Phone' => $Phone, 'Email' => $Email, 'Address' => $Address, 'Country' => $Country, 'PostalCode' => $PostalCode, 'Gender' => $Gender, 'type' => "tenant"]); $messge['status'] = 1; $messge['msg'] = "Tenant registered"; } } elseif ($memberType == 'Landlord') { $users = DB::table('tbllandlord')->select(DB::raw('*'))->where('UserName', '=', $userName)->orWhere('Email', '=', $Email)->get(); $user1 = DB::table('tbltenant')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); $user2 = DB::table('tblvehicleowner')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); if (!empty($users) or !empty($user1) or !empty($user2)) { $messge['status'] = -1; $messge['msg'] = "User name or Password already exist"; } else { $user = userLandlord::create(['FirstName' => $firstName, 'LastName' => $lastName, 'UserName' => $userName, 'Password' => $Password, 'DOB' => $DOB, 'Phone' => $Phone, 'Email' => $Email, 'Address' => $Address, 'Country' => $Country, 'PostalCode' => $PostalCode, 'Gender' => $Gender, 'type' => "Landlord"]); /** $messge['status'] = 1; $messge['msg'] = "Please wait..."; $subject = "Hello" . $userName; $body ="Please confirm your mail"; $to=$Email; $this->emailConfirmation($userName, $to, $subject, $body); $messge['status'] = 1; $messge['msg'] = "LandLord Successfully registered, Please confirm your mail."; **/ } } elseif ($memberType == 'Vehicle Owner') { $users = DB::table('tblvehicleowner')->select(DB::raw('*'))->where('UserName', '=', $userName)->orWhere('Email', '=', $Email)->get(); $user2 = DB::table('tbllandlord')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); $user1 = DB::table('tbltenant')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); if (!empty($users) or !empty($user1) or !empty($user2)) { $messge['status'] = -1; $messge['msg'] = "User name or Password already exist"; } else { $user = vehicleOwnerModel::create(['FirstName' => $firstName, 'LastName' => $lastName, 'UserName' => $userName, 'Password' => $Password, 'DOB' => $DOB, 'Phone' => $Phone, 'Email' => $Email, 'Address' => $Address, 'Country' => $Country, 'PostalCode' => $PostalCode, 'Gender' => $Gender, 'type' => "vehicleowner"]); $messge['status'] = 1; $messge['msg'] = "Vehicle Owner registered"; } } echo json_encode($messge); }
public function registerUser(Request $request) { $messge = array("status" => 0); if (isset($_REQUEST['firstName']) && !empty($_REQUEST['firstName'])) { $firstName = $_REQUEST['firstName']; } if (isset($_REQUEST['lastName']) && !empty($_REQUEST['lastName'])) { $lastName = $_REQUEST['lastName']; } if (isset($_REQUEST['userName']) && !empty($_REQUEST['userName'])) { $userName = $_REQUEST['userName']; } if (isset($_REQUEST['Password']) && !empty($_REQUEST['Password'])) { $Password = md5($_REQUEST['Password']); } if (isset($_REQUEST['DOB']) && !empty($_REQUEST['DOB'])) { $DOB = $_REQUEST['DOB']; } if (isset($_REQUEST['phone']) && !empty($_REQUEST['phone'])) { $Phone = $_REQUEST['phone']; } if (isset($_REQUEST['Email']) && !empty($_REQUEST['Email'])) { $Email = $_REQUEST['Email']; } if (isset($_REQUEST['address']) && !empty($_REQUEST['address'])) { $Address = $_REQUEST['address']; } if (isset($_REQUEST['postalCode']) && !empty($_REQUEST['postalCode'])) { $PostalCode = $_REQUEST['postalCode']; } $Gender = $_REQUEST['rdbGender']; $Country = $_REQUEST['country']; $memberType = $_REQUEST['userType']; if ($memberType == 'Tenant') { $users = DB::table('tbltenant')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); $user1 = DB::table('tbllandlord')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); $user2 = DB::table('tblvehicleowner')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); if (!empty($users) or !empty($user1) or !empty($user2)) { $messge['status'] = -1; $messge['msg'] = "Already exists"; } else { $user = User::create(['FirstName' => $firstName, 'LastName' => $lastName, 'UserName' => $userName, 'Password' => $Password, 'DOB' => $DOB, 'Phone' => $Phone, 'Email' => $Email, 'Address' => $Address, 'Country' => $Country, 'PostalCode' => $PostalCode, 'Gender' => $Gender, 'type' => "tenant"]); $messge['status'] = 1; $messge['msg'] = "Tenant registered"; } } elseif ($memberType == 'Landlord') { $users = DB::table('tbllandlord')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); $user1 = DB::table('tbltenant')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); $user2 = DB::table('tblvehicleowner')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); if (!empty($users) or !empty($user1) or !empty($user2)) { $messge['status'] = -1; $messge['msg'] = "Already exists"; } else { $user = userLandlord::create(['FirstName' => $firstName, 'LastName' => $lastName, 'UserName' => $userName, 'Password' => $Password, 'DOB' => $DOB, 'Phone' => $Phone, 'Email' => $Email, 'Address' => $Address, 'Country' => $Country, 'PostalCode' => $PostalCode, 'Gender' => $Gender, 'type' => "Landlord"]); $messge['status'] = 1; $messge['msg'] = "LandLord registered"; } } elseif ($memberType == 'Vehicle Owner') { $users = DB::table('tblvehicleowner')->select(DB::raw('*'))->where('UserName', '=', $userName)->get(); if (!empty($users)) { $messge['status'] = -1; $messge['msg'] = "Already exists"; } else { $user = vehicleOwnerModel::create(['FirstName' => $firstName, 'LastName' => $lastName, 'UserName' => $userName, 'Password' => $Password, 'DOB' => $DOB, 'Phone' => $Phone, 'Email' => $Email, 'Address' => $Address, 'Country' => $Country, 'PostalCode' => $PostalCode, 'Gender' => $Gender, 'type' => "vehicleowner"]); $messge['status'] = 1; $messge['msg'] = "Vehicle Owner registered"; } } echo json_encode($messge); }