public function sendProductActionMail($p_id, $action, $input_arr) { $product_details = Product::whereRaw('id = ?', array($p_id))->first(); $user_details = CUtil::getUserDetails($product_details->product_user_id); $product_code = $product_details->product_code; $url_slug = $product_details->url_slug; $view_url = $this->getProductViewURL($product_details->id, $product_details); $user_type = CUtil::isSuperAdmin() ? 'Admin' : 'Staff'; $logged_user_id = isLoggedin() ? getAuthUser()->user_id : 0; $staff_details = CUtil::getUserDetails($logged_user_id); $data = array('product_code' => $product_details['product_code'], 'product_name' => $product_details['product_name'], 'display_name' => $user_details['display_name'], 'user_email' => $user_details['email'], 'action' => $action, 'view_url' => $view_url, 'admin_notes' => isset($input_arr['comment']) ? $input_arr['comment'] : '', 'user_type' => $user_type); $data['product_details'] = $product_details; $data['user_details'] = $user_details; $data['staff_details'] = $staff_details; //Mail to User Mail::send('emails.mp_product.productStatusUpdate', $data, function ($m) use($data) { $m->to($data['user_email']); $subject = str_replace('VAR_PRODUCT_CODE', $data['product_code'], trans('email.productStatusUpdate')); $m->subject($subject); }); //Send mail to admin $mailer = new AgMailer(); $data['subject'] = str_replace('VAR_PRODUCT_CODE', $data['product_code'], trans('email.productStatusUpdateAdmin')); $mailer->sendAlertMail('mp_product_status_update', 'emails.mp_product.productStatusUpdateAdmin', $data); }