/** * MessagingService::sendMessageAddedNotification() * Mail notification to admin & user regarding the message posted * @param mixed $message_id * @return */ public function sendMessageAddedNotification($message_id) { if ($message_id) { //To Admin $message_details = Message::where('id', $message_id)->where('is_deleted', 0)->first(); $data_arr['from_user_details'] = CUtil::getUserDetails($message_details->from_user_id); $data_arr['to_user_details'] = CUtil::getUserDetails($message_details->to_user_id); $data_arr['subject'] = trans('webshoppack::common.new_message_posted_mail_for_admin'); $data_arr['message_text'] = $message_details->message_text; $data_arr['message_subject'] = $message_details->subject; $data_arr['date_posted'] = date('Y-m-d', strtotime($message_details->date_added)); \Mail::send('webshoppack::emails.newMessagePostedMailForAdmin', $data_arr, function ($m) use($data_arr) { $m->to(Config::get('webshoppack::admin_mail')); $m->subject($data_arr['subject']); }); //To User $data_arr['to_email'] = $data_arr['to_user_details']['email']; $data_arr['to_name'] = $data_arr['to_user_details']['display_name']; $data_arr['subject'] = $message_details->subject; \Mail::send('webshoppack::emails.newMessagePostedMailForUser', $data_arr, function ($m) use($data_arr) { $m->to($data_arr['to_email'], $data_arr['to_name']); $m->subject($data_arr['subject']); }); } }
/** * MessageAddController::getAdd() * * @return */ public function getAdd($user_code) { $this->addMessageService = new MessageAddService(); $this->productViewService = new ViewProductService(); $type = 'viewshop'; $d_arr = array(); $is_valid_user = false; $user_id = CUtil::getUserId($user_code); $user_details = CUtil::getUserDetails($user_id); if (count($user_details) > 0) { $user = Config::get('webshoppack::logged_user_id'); $logged_user_id = $user(); if ($user_id != $logged_user_id) { $is_valid_user = true; } } if ($is_valid_user) { $d_arr['user_code'] = $user_code; $d_arr['type'] = $type; } else { $d_arr['error_msg'] = trans('webshoppack::messaging.addMessage.invalid_user'); $d_arr['type'] = ''; } return View::make('webshoppack::addMessage', compact('d_arr')); }
public static function populateShopProducts($user_code) { $product_arr = array(); $messageAddService = new MessageAddService(); //Get User id from user code $user_id = CUtil::getUserId($user_code); if ($user_id > 0) { $product_details = Product::whereRaw('product_user_id = ?', array($user_id))->get(array('product_name', 'id')); $product_arr[""] = trans("webshoppack::common.select_option"); if (count($product_details) > 0) { foreach ($product_details as $product) { $product_arr[$product['id']] = $product['product_name']; } } return $product_arr; } }
public static function getUserDetails($user_id) { return CUtill::getUserDetails($user_id); }
public static function getShopImage($shop_id, $image_size = "thumb", $shop_image_info = array(), $cache = true) { $image_exists = false; $image_details = array(); if (count($shop_image_info) == 0) { $shop_image_info = ShopDetails::whereRaw('id = ? ', array($shop_id))->first(); } if (count($shop_image_info) > 0 && $shop_image_info['image_name'] != '') { $image_exists = true; $image_details["image_id"] = $shop_image_info['id']; $image_details["image_ext"] = $shop_image_info['image_ext']; $image_details["image_name"] = $shop_image_info['image_name']; $image_details["image_server_url"] = $shop_image_info['image_server_url']; $image_details["image_thumb_width"] = $shop_image_info['t_width']; $image_details["image_thumb_height"] = $shop_image_info['t_height']; $image_details["image_folder"] = Config::get("webshoppack::shop_image_folder"); } $image_path = ""; $image_url = ""; $image_attr = ""; if ($image_exists) { $image_path = URL::asset(Config::get("webshoppack::shop_image_folder")) . "/"; } $cfg_shop_img_thumb_width = Config::get("webshoppack::shop_image_thumb_width"); $cfg_shop_img_thumb_height = Config::get("webshoppack::shop_image_thumb_height"); switch ($image_size) { case "thumb": $image_url = ""; $image_attr = ""; if ($image_exists) { $image_url = $image_path . $image_details["image_name"] . "_T." . $image_details["image_ext"]; $image_attr = CUtil::TPL_DISP_IMAGE($cfg_shop_img_thumb_width, $cfg_shop_img_thumb_height, $image_details["image_thumb_width"], $image_details["image_thumb_height"]); } break; default: $image_url = ""; $image_attr = ""; if ($image_exists) { $image_url = $image_path . $image_details["image_name"] . "_T." . $image_details["image_ext"]; $image_attr = CUtil::TPL_DISP_IMAGE(90, 90, $image_details["image_thumb_width"], $image_details["image_thumb_height"]); } } $image_details['image_url'] = $image_url; $image_details['image_attr'] = $image_attr; return $image_details; }