Esempio n. 1
0
 private function getUserBy($filter, $value)
 {
     $vehicleOwnerModel = vehicleOwnerModel::where($filter, '=', $value)->first();
     if (is_null($vehicleOwnerModel)) {
         $userLandlord = userLandlord::where($filter, '=', $value)->first();
         if (is_null($userLandlord)) {
             $adminModel = adminModel::where($filter, '=', $value)->first();
             if (is_null($adminModel)) {
                 $tenantModel = tenantModel::where($filter, '=', $value)->first();
                 if (is_null($tenantModel)) {
                     return null;
                 } else {
                     return $tenantModel;
                 }
             } else {
                 return $adminModel;
             }
         } else {
             return $userLandlord;
         }
     } else {
         return $vehicleOwnerModel;
     }
     return null;
 }
Esempio n. 2
0
 public function updateAccount(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'];
     $user = $request->session()->get('user');
     if ($user[0]->type == "tenant") {
         //Save room for user
         $tenant = User::find($user[0]->ID);
         $tenant->FirstName = $firstName;
         $tenant->LastName = $lastName;
         $tenant->Password = md5($Password);
         $tenant->save();
     } elseif ($user[0]->type == "landlord") {
         $landlord = userLandlord::find($user[0]->ID);
         $landlord->FirstName = $firstName;
         $landlord->LastName = $lastName;
         $landlord->Password = md5($Password);
         $landlord->save();
     } else {
         $vehicleowner = vehicleOwnerModel::find($user[0]->ID);
         $vehicleowner->FirstName = $firstName;
         $vehicleowner->LastName = $lastName;
         $vehicleowner->Password = md5($Password);
         $vehicleowner->save();
     }
     echo json_encode($messge);
 }