public function postForgotpassword() { try { $statusCode = 200; $response = array(); //get data from request and process $PostData = Input::all(); if (isset($PostData) && !empty($PostData)) { $params = array_map('trim', $PostData); //check for email address is available or not $checkEmail = Login::getCheckemailvalidation($params['email']); if (isset($checkEmail) && !empty($checkEmail)) { print_r('here...'); exit; //email variable declaration $subject = 'Forgot Password'; $email = $params['email']; $NewPassword = Login::generateRandomString(6); Mail::send(['text' => 'view'], $NewPassword, function ($message) { $message->to($email, 'Jon Doe')->subject('Welcome to the Laravel 5 Auth App!'); }); // if ($this->email->send()) { // //if email sent then update password in database // $UpdatePassword = $this->customer_model->UpdatePassword($CheckEmail['customer_id'], $NewPassword); // //print error response // $ResponseData['success'] = "1"; // $ResponseData['message'] = $this->lang->line('FORGOT_PASSWORD_SUCCESS'); // } else { // $ResponseData['success'] = "0"; // $ResponseData['message'] = $this->lang->line('GENERAL_ERROR'); // } } else { } } else { echo 'sdfsdfsd'; exit; //data not posted to method. } } catch (Exception $ex) { $statusCode = 400; } finally { return Response::json($response, $statusCode); } }