public function sendEmail($template, $data = [], $to, $toName, $subject, $cc = null, $bcc = null, $replyTo = null) { $result = false; try { $config = new Config(); $messageHeader = ['from' => $config->getValueByKey('address_sender_mail'), 'fromName' => $config->getValueByKey('display_name_send_mail'), 'to' => $to, 'toName' => $toName, 'cc' => $cc, 'bcc' => $bcc, 'replyTo' => $replyTo, 'subject' => $subject]; \Mail::send($template, $data, function ($message) use($messageHeader) { $message->from($messageHeader['from'], $messageHeader['fromName']); $message->to($messageHeader['to'], $messageHeader['toName']); if (!is_null($messageHeader['cc'])) { $message->cc($messageHeader['cc']); } if (!is_null($messageHeader['bcc'])) { $message->bcc($messageHeader['bcc']); } if (!is_null($messageHeader['replyTo'])) { $message->replyTo($messageHeader['replyTo']); } $message->subject($messageHeader['subject']); }); $result = true; } catch (Exception $e) { $result = ['success' => false, 'message' => $e->getMessage()]; } return \Response::json($result); }
public function assignRoleUser($rid) { // get the query string from the url $uid = Request::get('uid'); // find the user and update the user role. $user = User::find($uid); $user->role_id = $rid; $user->save(); //return response as JSON return Response::json($user); }
public function ajaxImageUpload() { $user_id = Input::get('user_id'); $file = Input::file('display_image'); //get the image folder to store the image, in this case the specific restaurant folder. $image_folder = '/assets/images/users/'; //upload the image and return the file path $file_path = Image::uploadImage($file, $image_folder); if ($file_path['status'] != 1) { return Response::json(['success' => false, 'errors' => $file_path['errors']]); } $user = User::find($user_id); $user->display_image = $file_path['data']; $user->save(); User::updateUserSession(); return Response::json(['success' => true, 'message' => 'Profile Image Updated.', 'file' => $user->display_image]); }