protected function _execute(array $data) { //print_r($data); exit; if (null != $data['email']) { $adminEmail = "*****@*****.**"; //EMAIL THE Admin $subject = __('A new form submission been received from the MarketingConneX.com Challenges landing page'); $email = new Email('default'); $email->sender($data['email'], $data['firstname']); $email->from([$data['email'] => $data['firstname']])->to([$adminEmail => 'marketingconneX.com'])->subject($subject)->emailFormat('html')->template('landingpageform')->viewVars(array('firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'email' => $data['email'], 'website' => $data['website'], 'phone' => $data['phone'], 'info' => $data['info'], 'landingpage' => $data['landingpage']))->send(); return true; } return false; }
protected function _execute(array $data) { //print_r($data); exit; if (null != $data['email']) { //SEND TO SALES FORCE //----------------------------------- //then bundle the request and send it to Salesforce.com $req = "&lead_source=" . "Web"; $req .= "&first_name=" . $data['firstname']; $req .= "&last_name=" . $data['lastname']; $req .= "&company=" . $data['company']; $req .= "&00N20000009ZAQB=" . $data['position']; $req .= "&email=" . $data['email']; $req .= "&phone=" . $data['phone']; $req .= "&debug=" . urlencode("0"); $req .= "&oid=" . urlencode("00D20000000ozqG"); $req .= "&retURL=" . urlencode("http://qa.marketingconnex.com/pages/thank-you"); $req .= "&debugEmail=" . urlencode("*****@*****.**"); $header = "POST /servlet/servlet.WebToLead?encoding=UTF-8 HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Host: www.salesforce.com\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen('www.salesforce.com', 80, $errno, $errstr, 30); if (!$fp) { echo "No connection made"; } else { fputs($fp, $header . $req); while (!feof($fp)) { $res = fgets($fp, 1024); //echo $res; } } fclose($fp); //----------------------------------- $adminEmail = "*****@*****.**"; //EMAIL THE CUSTOMER $subject = __('Thank you for contacting MarketingConneX.com'); $email = new Email('default'); $email->sender($adminEmail, 'marketingconneX.com'); $email->from([$adminEmail => 'marketingconneX.com'])->to([$data['email'] => $data['name']])->subject($subject)->emailFormat('html')->template('contactform', 'system')->viewVars(array('email_type' => 'customer', 'name' => $data['firstname'], 'company' => $data['company'], 'position' => $data['position'], 'email' => $data['email'], 'site_url' => 'http://www.marketingconnex.com', 'SITE_NAME' => 'MarketingConneX.com', 'phone' => $data['phone'], 'info' => $data['info'], 'message' => $data['message']))->send(); //EMAIL THE Admin $subject = __('A new enquiry has been received on MarketingConneX.com'); $email = new Email('default'); $email->sender($adminEmail, 'marketingconneX.com'); $email->from([$data['email'] => $data['name']])->to([$adminEmail => 'marketingconneX.com'])->subject($subject)->emailFormat('html')->template('contactform', 'system')->viewVars(array('email_type' => 'admin', 'name' => $data['firstname'], 'company' => $data['company'], 'position' => $data['position'], 'email' => $data['email'], 'site_url' => 'http://www.marketingconnex.com', 'SITE_NAME' => 'MarketingConneX.com', 'phone' => $data['phone'], 'info' => $data['info'], 'message' => $data['message']))->send(); return true; } return false; }
public function resetpassword($token) { $this->loadModel('UserPwordResets'); $upr = $this->UserPwordResets->find('all')->where(['token' => $token, 'status' => 'A', 'expiry_date >' => time()])->first(); if (isset($upr)) { $usrdet = $this->Users->find('all')->where(['username' => $upr->username])->first(); //print_r($usrdet);exit; if (isset($usrdet)) { $rchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#\$%^&*()_-=+;:,.?"; $pwrd = substr(str_shuffle($rchars), 0, 8); $usrdet->password = $pwrd; $usrdet->role = $usrdet->role; if ($this->Users->save($usrdet)) { $site_url = Router::url('/', true); $msg = __('Your password has been changed for the following account:<br>') . $site_url . __(' <br> Username: '******' <br> Password: '******'default'); $fgemail->sender($this->portal_settings['site_email'], $this->portal_settings['site_name']); $fgemail->from([$this->portal_settings['site_email'] => $this->portal_settings['site_name']])->to($upr->email)->subject(__('New Password'))->emailFormat('both')->send($msg); $this->Flash->success(__('New log in details have been sent to your email address.')); $upr->status = 'S'; $this->UserPwordResets->save($upr); } } } else { $this->Flash->error(__('Invalid token')); } return $this->redirect(['action' => 'login']); }
/** * Add a new order method * * This is to let customers(users) start a new order and will probably be automated by the shopping cart * in all cases unless an admin user is generating an order manually. * * @return void Redirects on successful add, renders view otherwise. */ public function add() { //create a new order entity in the database $order = $this->Orders->newEntity(); //if the http request is of type post then if ($this->request->is('post')) { //use the data in the add order form to update the new order Database entry $order = $this->Orders->patchEntity($order, $this->request->data); //pre set the ordered_date and courier id as we are not including that this build. $order->ordered_date = date("Y-m-d"); $order->courier_id = "1"; //set gged in user id as the order user id property $loggedUser = $this->request->session()->read('user'); $order->user_id = $loggedUser['id']; if ($this->request->session()->read('userRole') == 'user') { //grab the users customer ID to add to the order $query = TableRegistry::get('Customers')->find(); $query->where(['user_id' => $order->user_id]); foreach ($query as $orderCustomer) { //set the ordering customer id as users ID $order->customer_id = $orderCustomer['id']; } } //otherwise we show the drop down list and select the customer ID from there, allowing for // customer selection on order creation for, //if the order save process is a success if ($this->Orders->save($order)) { //show user it worked and redirect them back to the order listing (will soon be only their orders listed) $this->Flash->success('The order has been placed in our system. Your order will be processed soon.'); //send an email to rick letting him know that an order was placed. //Send email to customer with their new reset password hashed link/url //create email object and set email config settings $orderEmail = new Email('default'); $orderEmail->transport('default'); //set the type of email format and use our custom template. $orderEmail->emailFormat('html'); $orderEmail->template('order_email'); //set the email to send to $orderEmail->to(Configure::read('orderRecievedEmail')); $orderEmail->subject('Solemate Order has been placed on ' . date("Y-m-d")); //Set the email headers. $orderEmail->from(['*****@*****.**' => 'Solemate Doormats Web Orders']); $orderEmail->sender(['*****@*****.**' => 'Solemate Doormats inc']); $orderEmail->replyTo('*****@*****.**'); //email message and send line $orderEmail->send('Hi there admin this is an automated email to let you know a new order has been placed on the website ordering system, the order id is ' . $order->id . '. The customer id was ' . $order->customer_id); return $this->redirect(['action' => 'index']); } else { $this->Flash->error('The order could not be saved. Please, try again.'); } } //get all couriers and customers ready for linking to this new order //(customer = orderie & courier = delivery choice by customer/user) $couriers = $this->Orders->Couriers->find('list', ['limit' => 200]); //check if the user is a salesRep then just show only his customers. if ($this->request->session()->read('userRole') == 'salesRep') { //grab all customers from the model //$allCusts = $this->Customers->find("all"); $query = TableRegistry::get('Customers')->find("all"); //create space for just the logged in users customers $repCustomers = array(); //loop through all customers foreach ($query as $aCust) { //if the logged in user id matches the stored customer-user id if ($this->Auth->user('id') == $aCust['user_id']) { //debug($aCust); //push the specific contents onto the customers array for display on add order view page. array_push($repCustomers, array($aCust['id'] => $aCust['first_name'] . ' ' . $aCust['last_name'])); } } //now set the view variable as the users customers only. $customers = $repCustomers; } else { if ($this->request->session()->read('userRole') == 'admin') { $customers = $this->Orders->Customers->find('list', ['limit' => 200]); } } //set the ViewVars for the view page add. $this->set(compact('order', 'couriers', 'customers')); $this->set('_serialize', ['order']); }
/** * Reset Password method * * @param string|null $id User id. * @return void Redirects to password reset page. * @throws \Cake\Network\Exception\NotFoundException When user record not found. * * @description This will run when the user clicks on the reset password * link to generate a new replacment password. This is done by entering their email address * that they registered with, this ensures the user owns the account * they are resetting the password on and also that they cant intercept the * new password. We firstly generate a random string storing it in the database then * this string is sent as part of the users link to click on again ensuring the user requesting * the new password is the one who owns the account. After the user arrives at the url they are * presented with a small form consisting of 2 password fields: Password & Confirm Password * after a quick check that the passwords match the new password is Hashed and stored in the DB * and the user is returned to the log in page with a flash message telling them it worked * if there was an error the page will not re direct and will display the error allowing user to retry. * */ public function resetPassword() { //set this function to only run with data from a post request //$this->request->allowMethod(['post']); //check the form has been submitted if (isset($_POST['txtEmail'])) { /* Build a custom SQL query object to find all users and filter that to the user whos email matches the form data on the reset password form. */ $query = TableRegistry::get('Users')->find(); $query->where(['email' => $_POST['txtEmail']]); //loop through query result foreach ($query as $user) { //when we match on the right user data from our DB lookup if ($user->email == $_POST['txtEmail']) { //set the viewVariable to this userEmail. $selectedUser = $user; } } //end foreach query result (should only be one in this case) if (isset($selectedUser)) { //if the selectedUser data isSet then set the viewVar with this data else do nothing to prevent empty form submit. $this->set('selectedUser', $selectedUser); //Create new random HASHED String to send to user // for security and randomness i mixed older md5 with nice sha256 ;) $intermediateSalt = md5(uniqid(rand(), true)); //set a temp string of 7 digits in length no decimal places $salt = substr($intermediateSalt, 0, 7); //now run random string through a 256bit sha encrypt - maybe overkill? $randPassword = hash("sha256", $salt); //update the selectedUsers reset value from old to new. $selectedUser->reset = $randPassword; //Store temp HASH in user database //store the id of the user in question to save time on a db lookup. $id = $selectedUser->id; //Send email to customer with their new reset password hashed link/url //create email object and set email config settings $tempEmail = new Email('default'); $tempEmail->transport('default'); //set the type of email format and use our custom template. $tempEmail->emailFormat('html'); $tempEmail->template('sendPwreset'); //set the email to send to $tempEmail->to($selectedUser->email); $tempEmail->subject('Solemate Password Reset'); //Set the email headers. $tempEmail->from(['*****@*****.**' => 'Solemate Doormats inc']); $tempEmail->sender(['*****@*****.**' => 'Solemate Doormats inc']); $tempEmail->replyTo('*****@*****.**'); //generate a url using our generated random hash and user id $fullUrl = Router::url(array('controller' => 'Users', 'action' => 'resetPassword', 'pwr' => $selectedUser->reset, 'id' => $selectedUser->id), true); //Build the message to send to the users requesting the new password. $message = "Solemate Doormats Password Reset<br />We received a requested to reset the password on your account, If you made a mistake by clicking the forgot password link then please feel free to disregard this email. "; $message .= " We would like you to click the link below to reset your login password,<br />"; $message .= "<a href='" . $fullUrl . "'>Click here to reset/change your password.</a><br />"; $message .= "If you continue to get these password reset emails without requesting them feel free to contact the admin staff by email here at Solemate Doormats and we can investigate it for you."; $message .= ". Here at Solemate Doormats we keep our users passwords private even from the admins. Feel free to drop us a email if"; $message .= " you would like more information on your account security, or if you feel someone else is requesting these password resets maliciously."; $message .= "<br /><br /><br /><b>Privacy Agreement:</b><i>All content sent / displayed from Solemate Doormats / IB Australia is for private customer use only, any materials shown in these emails are copyright"; $message .= " protected by Solemate Doormats and should under no circumstance be used without written consent from the company owner, any use of these materials"; $message .= " without consent will be seen as an act of IP copyright breach and will be followed with appropriate legal action. If you are not the intended recipient of this email please disregard and delete this message, if this is in hard copy please shred any copies you may have received in error. "; $message .= "Materials covered by I.P. copyright: Logo's, Doormat print's / design's, the Solemate Doormats trading name, Solemate Doormats colour scheme's."; $message .= "<br /><p align='center'> © 2015 IB Australia - Solemate Doormats</p></i>"; /* Use a custom query to save our new random string into the users db entry for checking user email starts the password reset. */ $query2 = TableRegistry::get('Users')->find(); $query2->update('Users')->set(['reset' => $randPassword])->where(['id' => $id]); $stmt = $query2->execute(); //May not be needed $tempEmail->viewVars(array('cust' => $selectedUser)); //email message and send line $tempEmail->send($message); } else { $this->Flash->error('Error: This user email address was not found in our database. Try again with the address you registered with please.'); } } else { if (isset($_GET['pwr']) && isset($_GET['id'])) { //set the user ID from get ID passed then lookup all users by that ID number. $id = $_GET['id']; $user = $this->Users->get($id, ['contain' => []]); //if the request is of type post, patch or put then if ($this->request->is(['patch', 'post', 'put'])) { //set the new data to the current user in the user variable. $user = $this->Users->patchEntity($user, $this->request->data); //if the save of the user data(password) is successfull then if ($this->Users->save($user)) { $this->Flash->success('Success: Your login password has been changed ' . $user->username . '. '); return $this->redirect(['action' => 'login']); } else { $this->Flash->error('The new password could not be saved. Please, try again.'); } } //end of if request is patch,post,put //set the current user data as a viewVariable. $this->set(compact('user')); $this->set('_serialize', ['user']); } } //end of else if GET variables are set }
public function freeTrial($vid = 0) { $users = TableRegistry::get('Users'); $vendors = TableRegistry::get('Vendors'); if ($vid > 0) { $vendor_contacts = $vendors->find('all')->contain(['VendorManagers', 'VendorManagers.Users'])->hydrate(false)->where(['Vendors.id' => $vid])->first(); $subject = __('We have received your Free Trial Request for ') . $this->portal_settings['site_name']; $vndemail = new Email('default'); $vndemail->sender($this->portal_settings['site_email'], $this->portal_settings['site_name']); foreach ($vendor_contacts['vendor_managers'] as $vm) { $vndemail->from([$this->portal_settings['site_email'] => $this->portal_settings['site_name']])->to([$vm['user']['email'] => $vm['user']['first_name'] . ' ' . $vm['user']['last_name']])->subject($subject)->emailFormat('html')->template('freetrial', 'system')->viewVars(array('email_type' => 'vendor', 'firstname' => $vm['user']['first_name'], 'company_name' => $vendor_contacts['company_name'], 'site_url' => $this->portal_settings['site_url'], 'vendor_id' => $vid))->send(); $vendorEmail = $vm['user']['email']; } /* * Send e-mail to administrator */ $admins = $users->find()->hydrate(false)->where(['role' => 'admin', 'status' => 'Y']); $ademail = new Email('default'); $ademail->sender($this->portal_settings['site_email'], $this->portal_settings['site_name']); $subject = __('Free Trial Request for ') . $vendor_contacts['company_name']; $vndemail = new Email('default'); $vndemail->sender($vendorEmail, $vendor_contacts['company_name']); foreach ($admins as $admin) { $ademail->from([$this->portal_settings['site_email'] => $this->portal_settings['site_name']])->to([$admin['email'] => $admin['first_name'] . ' ' . $admin['last_name']])->subject($subject)->emailFormat('html')->template('freetrial')->viewVars(array('email_type' => 'admin', 'username' => $admin['first_name'], 'company_name' => $vendor_contacts['company_name'], 'site_url' => $this->portal_settings['site_url'], 'vendor_id' => $vid))->send(); } } return true; }
public function report($id = null) { $resource = $this->Resources->get($id, ['contain' => ['Folders', 'Users', 'Vendors']]); if ($this->request->is(['post', 'put'])) { $users = $this->Users->find()->where(['role' => 'admin', 'status' => 'Y']); foreach ($users as $user) { $admins[] = $user->email; } $msg = "\nFile ID: {$resource->id}<br />\nFile: {$resource->sourcepath}<br />\nOwner: {$resource->user->username}<br />\nVendor: {$resource->vendor->company_name}<br />\nFile URL: {$resource->publicurl}<br />\n<br />\n "; $msg .= $this->request->data['message']; $fgemail = new Email('default'); $fgemail->sender($this->portal_settings['site_email'], $this->portal_settings['site_name']); $fgemail->from([$this->portal_settings['site_email'] => $this->portal_settings['site_name']])->to($admins)->subject(__('Resource Abuse Report'))->emailFormat('both')->send($msg); $this->Flash->success('The resource has been reported for abuse.'); return $this->redirect(['controller' => 'PartnerResources', 'action' => 'navigate', $resource->folder_id]); } $this->set('resource', $resource); }
private function _generateEmails($loggedUser = null, $OrderingCustomer = null, $orderTotal = null, $order = null, $shopcart = null) { //choose to send email for new orders from here as well. with item list, customer details, //send an email to rick letting him know that an order was placed. //Send email to customer with their new reset password hashed link/url //create email object and set email config settings $orderEmail = new Email('default'); $orderEmail->transport('default'); //set the type of email format and use our custom template. $orderEmail->emailFormat('html'); $orderEmail->template('order_email'); //Set the email headers. $orderEmail->from(['*****@*****.**' => 'Solemate Doormats Web Orders']); $orderEmail->sender(['*****@*****.**' => 'Solemate Doormats inc']); $orderEmail->replyTo('*****@*****.**'); $fullOrderUrl = Router::url(array('controller' => 'Orders', 'action' => 'view', $order->id), true); //send the administrator order created email with listing of items, weights, totals etc //set the email to send to $orderEmail->to(Configure::read('orderRecievedEmail')); $orderEmail->subject('Solemate Order has been placed on ' . date("Y-m-d")); $message = "<table id='orderEmailTable' style='border: 1'><tr><th>Item Name</th><th>Item Cost (per Unit)</th><th>Base Weight (per Unit)</th>"; $message .= "<th>Total Wieght Ordered</th><th>Number of Bales</th></tr>"; foreach ($shopcart as $item) { $message .= "<tr><td>" . $item['item_name'] . "</td>" . "<td>" . $item['base_price'] . "</td><td>" . $item['matt_weight']; $message .= "</td><td>" . h($item['matt_weight'] * $item['_joinData']['quantity']) . "</td><td>" . h($item['_joinData']['quantity'] / $item['matt_bale_count']) . "</td>"; } $message .= "</tr></table>"; //send email with body message of $orderEmail->send('Hi there Solemate Admin, this is an automated email to let you know a new order has been placed on the website ordering system,' . ' the order id is ' . $order->id . '. The customer placing the order was ' . $OrderingCustomer['first_name'] . ' ' . $OrderingCustomer['last_name'] . ', and was placed by the user: '******'username'] . ' who has the role of ' . $this->request->session()->read('userRole') . ' user type. ' . ' The url to view to this order is <a href="' . $fullOrderUrl . '">' . $OrderingCustomer['first_name'] . ' ' . $OrderingCustomer['last_name'] . '\'s New Order</a> you will need to log in if you have not already done so recently. The invoice total will be (inc GST)$' . $orderTotal . '<br />' . $message); //set the email touser letting them know of their order items and total. $orderEmail1 = new Email('default'); $orderEmail1->transport('default'); //set the type of email format and use our custom template. $orderEmail1->emailFormat('html'); $orderEmail1->template('order_email'); //Set the email headers. $orderEmail1->from(['*****@*****.**' => 'Solemate Doormats Web Orders']); $orderEmail1->sender(['*****@*****.**' => 'Solemate Doormats inc']); $orderEmail1->replyTo('*****@*****.**'); $orderEmail1->to($loggedUser['email']); $orderEmail1->subject('Your Solemate Order was placed on ' . date("Y-m-d")); //send email with body message of $orderEmail1->send('Hi there ' . $loggedUser['username'] . ', this is an automated email to let you know your order has been placed on the Solemate ordering system and our sales team will be in touch with the invoice and payment details.' . '<br />Order id is ' . $order->id . ', and was placed by the user: '******'username'] . ' who has the role of ' . $this->request->session()->read('userRole') . ' user type. ' . ' The url to view to view details of this order is <a href="' . $fullOrderUrl . '">' . $OrderingCustomer['first_name'] . ' ' . $OrderingCustomer['last_name'] . '\'s New Order</a> you will need to log in if you have not already done so recently. The invoice total will be (inc GST)' . $orderTotal . '.'); return true; }
/** * sendEmail method * * @param string|null $id Customer id. * @return void Redirects to index. * @throws \Cake\Network\Exception\NotFoundException When record not found. * * This function is built from Janet Fraiser's example site "Buckemoff Horses" on * the monash IE development server, it is used to build an email to one or many * customers in the Solemate Doormat's database. */ public function buildEmails() { //Set a variable for use on the index view to show user name / email. $this->set('username', $this->Auth->user('username')); //Set a var with logged in user data $setUser = $this->request->session()->read('user'); //set the loggedin user ID as a var $setID = $setUser['id']; $userRole = $this->request->session()->read('userRole'); if ($userRole != 'admin') { $this->Flash->error("Were sorry your not authorised to view this page, please contact admin if you feel this is incorrect."); return $this->redirect(['action' => 'index']); } $this->set("customers", $this->Customers->find("all", ['order' => 'last_name ASC'])); //create the viewVar array to be populated and sent via emails $allUsers = array(); $custTo = "<br />"; $customerList = array(); //create email object and set email config settings $email = new Email('default'); $email->transport('default'); if ($this->request->is('post') || $this->request->is('put')) { $list = 0; foreach ($this->request->data['Email']['checkbox'] as $id => $checked) { if ($checked) { $list++; $cust = $this->Customers->get($id, ['contain' => []]); $customerList[$list] = $cust->first_name . ' ' . $cust->last_name; /* //add the checked customers to the email list. $email->addTo($cust->email); */ //store this customer data into our viewVar array array_push($allUsers, $cust); //debug($allUsers); } //end of if checkbox is checked loop } //end foreach checkbox loop //set the type of email format and use our custom template. $email->emailFormat('html'); $email->template('sendEmail'); //loop through all customers sending the same email but with a // custom heading by a for loop setting viewVar and sending the email foreach ($allUsers as $custToSendTo) { //set the email to send to as this customer for this loop iteration //add the checked customers to the email list. $email->to($custToSendTo['email']); //grab the user data who we are sending too. $query = TableRegistry::get('Users')->find(); $query->where(['id' => $custToSendTo['user_id']]); //loop through query result foreach ($query as $user) { //debug($user); //when we match on the right user data from our DB lookup if ($user->id == $custToSendTo['user_id']) { //set the viewVariable to this user data -- // may limit the data sent for security soon. $userDetails = $user; } } //end foreach query result (should only be one in this case) //now send all our view vars over in the array $allUsers. $email->viewVars(['cust' => $custToSendTo]); $email->viewVars(['user' => $userDetails]); //Set the email headers. $email->from(['*****@*****.**' => 'Solemate Doormats inc']); $email->sender(['*****@*****.**' => 'Solemate Doormats inc']); $email->replyTo('*****@*****.**'); //Begin the email building from the data provided in the form. $email->subject($this->request->data['subject']); try { //Grab the main body of the email to be sent in the form. $email->send($this->request->data['message']); /* //loop through selected customers for showing in send to field of form. foreach ($customerList as $customer) { //print the customer names in the list above the email message $custTo .= $customer . "<br />"; } */ } catch (Exception $e) { //$this->Flash->error('Error sending email. ' . $e->getMessage()); } } /* //now send all our view vars over in the array $allUsers. $email->viewVars(array('cust' => $allUsers)); //Set the email headers. $email->from(['*****@*****.**' => 'Solemate Doormats inc']); $email->sender(['*****@*****.**' => 'Solemate Doormats inc']); $email->replyTo('*****@*****.**'); //Begin the email building from the data provided in the form. $email->subject($this->request->data['subject']); try { //Grab the main body of the email to be sent in the form. $email->send($this->request->data['message']); foreach ($customerList as $customer) { //print the customer names in the list above the email message $custTo .= $customer . "<br />"; } $this->Flash->success('Your email was successfully sent.'); //If the email is sent succesfully redirect back to the main customer page. return $this->redirect(['controller' => 'Customers', 'action' => 'index']); } catch(Exception $e) { $this->Flash->error('Error sending email. ' . $e->getMessage()); } */ if (isset($e)) { $this->Flash->error('Error sending email. ' . $e->getMessage()); } else { $this->Flash->success('Your email was successfully sent.'); //If the email is sent succesfully redirect back to the main customer page. return $this->redirect(['controller' => 'Customers', 'action' => 'index']); } } //end request is post / put checking if loop }