public function contestdelete() { $data = Input::get('contestid'); $searchkey = Input::get('searchkey'); /// Contest details ///// $contestdetailsformail = contestModel::select('user.firstname', 'user.lastname', 'user.username', 'contest.contest_name', 'contest.contesttype', 'user.email', 'contest.themephoto')->LeftJoin('user', 'user.ID', '=', 'contest.createdby')->where('contest.ID', $data)->first(); $contestname = $contestdetailsformail->contest_name; $contesttype = $contestdetailsformail->contesttype; if ($contestdetailsformail->firstname != '') { $name = $contestdetailsformail->firstname . ' ' . $contestdetailsformail->lastname; } else { $name = $contestdetailsformail->username; } $contest_id = $data; $email = $contestdetailsformail->email; $details = "Your contest " . $contestname . " is deleted by admin."; $contestimage = $contestdetailsformail->themephoto; $contestdetails = contestparticipantModel::where('contest_id', $data)->get(); for ($i = 0; $i < count($contestdetails); $i++) { $contestparticipantid = $contestdetails[$i]['ID']; $comment = commentModel::select('id')->where('contest_participant_id', $contestparticipantid)->get(); for ($i = 0; $i < count($comment); $i++) { $replycmt = replycommentModel::where('comment_id', $comment[$i]['id'])->get()->count(); if ($replycmt) { replycommentModel::where('comment_id', $comment[$i]['id'])->delete(); } } if (count($comment)) { commentModel::select('id')->where('contest_participant_id', $contestparticipantid)->delete(); } $votingcnt = votingModel::where('contest_participant_id', $contestparticipantid)->get()->count(); if ($votingcnt) { votingModel::where('contest_participant_id', $contestparticipantid)->delete(); } $participantid = contestparticipantModel::where('ID', $contestparticipantid)->get()->count(); if ($participantid) { $delete = contestparticipantModel::where('ID', $contestparticipantid)->delete(); } } $contestcatgory = contestinterestModel::where('contest_id', $data)->count(); if ($contestcatgory) { contestinterestModel::where('contest_id', $data)->delete(); } $deleteinvitecontest = invitegroupforcontestModel::where('contest_id', $data)->count(); if ($deleteinvitecontest) { invitegroupforcontestModel::where('contest_id', $data)->delete(); } $deletefollowercontest = invitefollowerforcontestModel::where('contest_id', $data)->count(); if ($deletefollowercontest) { invitefollowerforcontestModel::where('contest_id', $data)->delete(); } $privatecontestdelete = privateusercontestModel::where('contest_id', $data)->count(); if ($privatecontestdelete) { privateusercontestModel::where('contest_id', $data)->delete(); } $deletecontest = contestModel::where('ID', $data)->delete(); if ($deletecontest) { $this->contestchangesmaildelete($email, $name, $contestname, $contest_id, $contestimage, $details); } $er_data['message'] = 'Contest removed successfully'; return Redirect::to('managecontest')->with('er_data', $er_data)->with('usercontestlist', '')->with('searchkey', $searchkey); }
public function uninvite_allfollower() { $contest_id = $_GET['contest_id']; $follower_ids = Input::get("follower_list"); $follower_ids = explode(',', $follower_ids); $followercount = count($follower_ids); if ($followercount > 0) { for ($i = 0; $i < $followercount; $i++) { $invited = invitefollowerforcontestModel::where('follower_id', $follower_ids[$i])->where('contest_id', $contest_id)->count(); if ($invited == 1) { invitefollowerforcontestModel::where('follower_id', $follower_ids[$i])->where('contest_id', $contest_id)->delete(); $invited_member = privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $follower_ids[$i])->count(); if ($invited_member) { privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $follower_ids[$i])->delete(); } } } return 1; } else { return 0; } }
public function uninvitefollowerforcontest() { $contest_id = Input::get('contest_id'); $followerid = Input::get('follower_id'); $invited = invitefollowerforcontestModel::where('follower_id', $followerid)->where('contest_id', $contest_id)->count(); if ($invited == 1) { invitefollowerforcontestModel::where('follower_id', $followerid)->where('contest_id', $contest_id)->delete(); $invited_member = privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $followerid)->count(); if ($invited_member) { privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $followerid)->delete(); } $Response = array('success' => '1', 'message' => 'Uninvited successfully', 'msgcode' => "c198"); $final = array("response" => $Response); return json_encode($final); } else { $Response = array('success' => '0', 'message' => 'No data', 'msgcode' => "c199"); $final = array("response" => $Response); return json_encode($final); } }
if (Session::has('viewcommentforparticipant')) { $viewcommentforparticipant = Session::get('viewcommentforparticipant'); } if (isset($contest_id)) { $contestdetails = contestModel::where('ID', $contest_id)->first(); $owner_contest = ProfileModel::where('ID', $contestdetails['createdby'])->first(); } ////// New User save the private contest for Share the Contest ////// if ($contestdetails->visibility == 'p') { $privatecontestmodel = privateusercontestModel::where('user_id', Auth::user()->ID)->where('contest_id', $contest_id)->get()->count(); if ($privatecontestmodel == 0) { $private_cont['contest_id'] = $contest_id; $private_cont['user_id'] = Auth::user()->ID; $private_cont['requesteddate'] = date('Y-m-d H:i:s'); $private_cont['status'] = 1; privateusercontestModel::create($private_cont); } } $user_id = Auth::user()->ID; $old_cont_value = contestparticipantModel::where('contest_id', $contest_id)->where('user_id', $user_id)->first(); $old_cont_count = count($old_cont_value); ?> <div class="tabs-wrapper"> <input type="hidden" class="contest_id" value="{{ $contest_id }}" /> <input type="radio" name="tab" id="tab1" class="tab-head" onclick="showhide_subtab('{{$contest_id}}');" <?php if ($tab == "contest_info") { echo "checked"; } ?> /> <label for="tab1" id="txt_contestinfo">Contest Info</label> <?php
public function savecontest() { $conteststart = Input::get('conteststartdate'); $contestenddate = Input::get('contestenddate'); $votingstartdate = Input::get('votingstartdate'); $votingenddate = Input::get('votingenddate'); $a = 0; //if($conteststart<$contestenddate && $contestenddate<=$votingstartdate && $votingstartdate<$votingenddate){}else{ return "S"; } if ($conteststart > $contestenddate) { $a = 1; $er_data['contestenddate'] = 'Contest end date should be greater than contest start date'; } elseif (strtotime($contestenddate) > strtotime($votingstartdate)) { $a = 1; $er_data['votingstartdate'] = 'Voting start date should be greater than or equal to contest end date'; } elseif ($votingstartdate > $votingenddate) { $a = 1; $er_data['votingenddate'] = 'Voting end date should be greater than voting start date'; } if ($a == 1) { return Redirect::to('/contest')->withInput()->with('er_data', $er_data); } $inputdetails = Input::except(array('_token', 'themephoto', 'sponsor', 'sponsorphoto', 'sponsorname')); if (Input::file('themephoto') != '') { $destinationPath_them = 'public/assets/upload/contest_theme_photo'; $filename_them = Input::file('themephoto')->getClientOriginalName(); $Image_them = str_random(8) . '_' . $filename_them; $inputdetails['themephoto'] = $Image_them; } if (Auth::user()->ID == 1) { $inputdetails['sponsorname'] = Input::get('sponsorname'); if (Input::file('sponsorphoto') != '') { $destinationPath_spons = 'public/assets/upload/sponsor_photo'; $filename_spons = Input::file('sponsorphoto')->getClientOriginalName(); $Image_spons = str_random(8) . '_' . $filename_spons; $inputdetails['sponsorphoto'] = $Image_spons; } } $lantyp = Session::get('language'); if ($lantyp == "") { $lantyp = "value_en"; } $validation = Validator::make($inputdetails, contestModel::$rules); if ($validation->passes()) { if (Auth::user()->ID == 1) { $admintimezone = User::where('ID', 1)->get()->first(); $inputdetails['conteststartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['conteststartdate'])), $admintimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['contestenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['contestenddate'])), $admintimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['votingstartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingstartdate'])), $admintimezone->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['votingenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingenddate'])), $admintimezone->timezone, 'UTC', 'Y-m-d H:i:s'); } else { $inputdetails['conteststartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['conteststartdate'])), Auth::user()->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['contestenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['contestenddate'])), Auth::user()->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['votingstartdate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingstartdate'])), Auth::user()->timezone, 'UTC', 'Y-m-d H:i:s'); $inputdetails['votingenddate'] = timezoneModel::convert(date('Y-m-d H:i:s', strtotime($inputdetails['votingenddate'])), Auth::user()->timezone, 'UTC', 'Y-m-d H:i:s'); } $inputdetails['createdby'] = Auth::user()->ID; if (Auth::user()->ID == 1) { $inputdetails['visibility'] = Input::get('visibility'); } else { $inputdetails['visibility'] = "p"; } $inputdetails['status'] = 1; $inputdetails['createddate'] = $inputdetails['updateddate'] = date('Y-m-d H:i:s'); $file_them = Input::file('themephoto'); $file_spons = Input::file('sponsorphoto'); if (isset($inputdetails['sponsorphoto'])) { $uploadSuccess_spons = $file_spons->move($destinationPath_spons, $Image_spons); } if (isset($inputdetails['themephoto'])) { $uploadSuccess_them = $file_them->move($destinationPath_them, $Image_them); } $product = contestModel::create($inputdetails); $contest_id = $product->ID; $interest = Input::get('interest'); $interest_length = sizeof(Input::get('interest')); if ($interest_length > 0) { contestinterestModel::whereNotIn('category_id', $interest)->where('contest_id', '=', $contest_id)->delete(); for ($i = 0; $i < $interest_length; $i++) { $interes['contest_id'] = $contest_id; $interes['category_id'] = $interest[$i]; $userInterest = contestinterestModel::where('contest_id', $contest_id)->where('category_id', $interest[$i])->lists('category_id'); if (count($userInterest) < 1) { contestinterestModel::create($interes); /// Vew enhanchment for interest send push notification to appropriate user //// $pushnotificationdetail = userinterestModel::select('user.firstname', 'user.lastname', 'user.username', 'user.ID', 'user.email', 'user.gcm_id', 'user.device_type', 'user.timezone')->LeftJoin('user', 'user.ID', '=', 'user_interest.user_id')->where('interest_id', $interest[$i])->get(); for ($j = 0; $j < count($pushnotificationdetail); $j++) { if (Auth::user()->ID == 1) { if ($pushnotificationdetail[$j]['firstname'] != '') { $name = $pushnotificationdetail[$j]['firstname'] . ' ' . $pushnotificationdetail[$j]['lastname']; } else { $name = $pushnotificationdetail[$j]['username']; } $email = $pushnotificationdetail[$j]['email']; $gcm_id = $pushnotificationdetail[$j]['gcm_id']; $device_type = $pushnotificationdetail[$j]['device_type']; $uid = $pushnotificationdetail[$j]['ID']; $contestname = Input::get('contest_name'); $contesttype = Input::get('contesttype'); $contestimage = $Image_them; $conteststartdate = timezoneModel::convert($inputdetails['conteststartdate'], 'UTC', $pushnotificationdetail[$j]['timezone'], 'd-m-Y h:i:s'); $contestenddate = timezoneModel::convert($inputdetails['contestenddate'], 'UTC', $pushnotificationdetail[$j]['timezone'], 'd-m-Y h:i:s'); $this->Inviteforcontestintest($name, $email, $gcm_id, $device_type, $uid, $interest[$i], $contestname, $contest_id, $contesttype, $contestimage, $conteststartdate, $contestenddate); } } // //$interest[$i] } unset($interes); } } $private_cont['contest_id'] = $contest_id; $private_cont['user_id'] = Auth::user()->ID; $private_cont['requesteddate'] = date('Y-m-d H:i:s'); $private_cont['status'] = 1; if (Auth::user()->ID == 1) { if (Input::get('visibility') == 'p') { privateusercontestModel::create($private_cont); } } else { privateusercontestModel::create($private_cont); } return Redirect::to('contest_info/' . $product->ID); } else { if ($validation->messages()->first('contest_name') == "The contest name field is required.") { $er_msg_con_name = "The Contest Name field is required."; } else { $er_msg_con_name = $validation->messages()->first('contest_name'); } if ($validation->messages()->first('conteststartdate') == "The conteststartdate field is required.") { $er_msg_con_start = "The Contest Start Date field is required."; } else { $er_msg_con_start = $validation->messages()->first('conteststartdate'); } if ($validation->messages()->first('contestenddate') == "The contestenddate field is required.") { $er_msg_con_end = "The Contest End Date field is required."; } else { $er_msg_con_end = $validation->messages()->first('contestenddate'); } if ($validation->messages()->first('votingstartdate') == "The votingstartdate field is required.") { $er_msg_vote_start = "The Voting Start Date field is required."; } else { $er_msg_vote_start = $validation->messages()->first('votingstartdate'); } if ($validation->messages()->first('votingenddate') == "The votingenddate field is required.") { $er_msg_vote_end = "The Voting End Date field is required."; } else { $er_msg_vote_end = $validation->messages()->first('votingenddate'); } if ($validation->messages()->first('noofparticipant') == "The noofparticipant field is required.") { $er_msg_noof_part = "The No of Participant field is required."; } else { $er_msg_noof_part = $validation->messages()->first('noofparticipant'); } if ($validation->messages()->first('contesttype') == "The contesttype field is required.") { $er_msg_con_type = "The Contest Type field is required."; } else { $er_msg_con_type = $validation->messages()->first('contesttype'); } if ($validation->messages()->first('themephoto') == "The themephoto field is required.") { $er_msg_them = "The Contest Image field is required."; } else { $er_msg_them = $validation->messages()->first('themephoto'); } $languageDetails = languageModel::select($lantyp, 'ctrlCaptionId')->whereIn('value_en', [$er_msg_con_name, $er_msg_con_start, $er_msg_con_end, $er_msg_vote_start, $er_msg_vote_end, $er_msg_noof_part, $er_msg_con_type, $er_msg_them])->get()->toArray(); //return $validation->messages(); foreach ($languageDetails as $key => $val) { if (in_array($val['ctrlCaptionId'], ['alert_entercontestname', 'alert_alreadycontestname'])) { $er_data['contest_name'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_enterconteststartdate'])) { $er_data['conteststartdate'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_contestenddate'])) { $er_data['contestenddate'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_votingstartdate'])) { $er_data['votingstartdate'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_votingenddate'])) { $er_data['votingenddate'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_enternoofpartis'])) { $er_data['noofparticipant'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_entercontesttype'])) { $er_data['contesttype'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } elseif (in_array($val['ctrlCaptionId'], ['alert_themephoto'])) { $er_data['themephoto'] = "<span id='" . $val['ctrlCaptionId'] . "'>" . $val[$lantyp] . "</span>"; } } return Redirect::to('/contest')->withInput()->with('er_data', $er_data); } }
public function invitefollowesforcontest() { //invitefollowerforcontestModel $invite_type = Input::get('invite_type'); $contest_id = Input::get('contest_id'); $curdate = date('Y-m-d h:i:s'); $inpudetails['contest_id'] = $contest_id; $inpudetails['invitedate'] = $curdate; $contestdetails = contestModel::select('contest.createdby', 'contest.visibility', 'contest.contest_name', 'contest.contesttype', 'user.firstname', 'user.lastname', 'user.username')->LeftJoin('user', 'user.ID', '=', 'contest.createdby')->where('contest.ID', $contest_id)->get(); $userid = $contestdetails[0]['createdby']; if ($contestdetails[0]['firstname'] != '') { $contestcreatedby = $contestdetails[0]['firstname'] . ' ' . $contestdetails[0]['lastname']; } else { $contestcreatedby = $contestdetails[0]['username']; } $contesttype = $contestdetails[0]['contesttype']; if ($contesttype == 'p') { $contesttype = "Photo"; } else { if ($contesttype == 'v') { $contesttype = "Video"; } else { if ($contesttype == 't') { $contesttype = "Topic"; } } } $contestname = $contestdetails[0]['contest_name']; //$userid = Input::get('user_id'); if ($invite_type == 'All') { $invitedlis = invitefollowerforcontestModel::where('contest_id', $contest_id)->lists('follower_id'); $invitedcnt = count($invitedlis); if ($invitedcnt) { $uninvitedfollower = followModel::where('userid', Input::get('user_id'))->whereNotIn('id', $invitedlis)->lists('id'); } else { $uninvitedfollower = followModel::where('userid', Input::get('user_id'))->lists('id'); } if (count($uninvitedfollower)) { for ($i = 0; $i < count($uninvitedfollower); $i++) { $inpudetails['follower_id'] = $uninvitedfollower[$i]; invitefollowerforcontestModel::create($inpudetails); /******** Here want to set the Notification for Group Members *********/ //return $uninvitedfollower[$i]; $folloerdetails = followModel::select('user.firstname', 'user.lastname', 'user.username', 'user.ID as follower_user_id', 'user.gcm_id', 'user.email')->LeftJoin('user', 'user.ID', '=', 'followers.followerid')->where('followers.id', $uninvitedfollower[$i])->get(); $gcmid = $folloerdetails[0]['gcm_id']; $email = $folloerdetails[0]['email']; if ($contestdetails[0]['visibility'] == 'p') { $privat_user['user_id'] = $folloerdetails[0]['follower_user_id']; $privat_user['contest_id'] = $contest_id; $privat_user['requesteddate'] = date('Y-m-d H:i:s'); $privat_user['status'] = 1; $privatecontestcnt = privateusercontestModel::where('user_id', $folloerdetails[0]['follower_user_id'])->where('contest_id', $contest_id)->get()->count(); if ($privatecontestcnt == 0) { privateusercontestModel::create($privat_user); } } if ($gcmid != '') { $Message['user_id'] = $folloerdetails[0]['follower_user_id']; $Message['title'] = 'Ding Datt'; $Message['message'] = 'You are invited for the Contest :' . $contestdetails[0]['contest_name']; $Message['contest_id'] = $contest_id; $Message = array("notification" => $Message); $DeviceId = array($gcmid); $Message = array("notification" => $Message); $this->PushNotification($DeviceId, $Message); } else { //$contestcreatedby= User::find($contestdetails[0]['createdby']); Mail::send([], array('email' => $email, 'contestcreatedby' => $contestcreatedby, 'contesttype' => $contesttype, 'contestname' => $contestname, 'contest_id' => $contest_id), function ($message) use($email, $contestcreatedby, $contesttype, $contestname, $contest_id) { $mail_body = '<body style="padding:0px;margin:-20px 0 0 0px; font-family: Arial, Helvetica, sans-serif; color: #222222; font-size:12px;"> <div style="width:550px;height:auto; border:1px solid #d5d5d5;padding:0px;margin:0px;overflow:hidden;"> <div style="display:block; margin:25px; overflow:hidden;"> <div style="display:block; padding: 10px; border: 1px solid #e5e5e5; margin:10px 0px;"> <span style="padding:0px;margin:0px;font-weight:bold;">Invitation for join the contest.</span> </div> <div style="display: block; margin: 15px;"> <h4 style="padding:0px;margin:0; font-size:14px;color:#d33030;">Contest Details:</h4> </div> <p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;"> Contest Name:</span>' . $contestname . '</p> <p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;">Contest Type:</span>' . $contesttype . '</p> <p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;">Created by:</span>' . $contestcreatedby . '</p> <p style="margin-top:25px; font-size:11px; color: #999999; margin-left:15px;">This is auto generate email so please do not reply to this email.</p> <p style="margin-top:25px; font-size:11px; color: #999999; margin-left:15px;"><a href="' . URL::to('contest_info/' . $contest_id) . '" style="dislay:block;outline: none; padding:25px;margin:25px; min-height:110px; width:100%; overflow:hidden;">' . URL::to('contest_info/' . $contest_id) . '</a> </p> <div style="padding:0; margin:15px;"> <p style="padding:0px; font-weight: bold;">Thanks,</p> DingDatt</div> <a href="' . URL::to('contest_info/' . $contest_id) . '" style="dislay:block;outline: none; padding:25px;margin:25px; min-height:110px; width:100%; overflow:hidden;"> <img src="' . URL::to('assets/inner/img/DingDatt_logo_web1.png') . '" width="110" height="86" style="width:110px; padding:0px; margin:0px;" alt="DingDatt"/> </a> </div> <div style="height:25px; width:100%;"> </div> </div> </body>'; $message->setBody($mail_body, 'text/html'); $message->to($email); $message->subject('Dingdatt-Invitation for join the contest'); }); } } $Response = array('success' => '1', 'message' => 'Invited Successfully'); $final = array("response" => $Response); return json_encode($final); } else { $Response = array('success' => '0', 'message' => 'Already Invited All Followers'); $final = array("response" => $Response); return json_encode($final); } } else { $user_id = Input::get('user_id'); $follower_id = Input::get('follower_id'); $inpudetails['follower_id'] = $follower_id; invitefollowerforcontestModel::create($inpudetails); /******** Here want to set the Notification for Group Members *********/ $groupmemberlist = followModel::select('id')->where('userid', $user_id)->where('followerid', $follower_id)->get(); //return $groupmemberlist[0]['id']; /// $folloerdetails = followModel::select('user.firstname', 'user.lastname', 'user.username', 'user.ID as follower_user_id', 'user.gcm_id', 'user.email')->LeftJoin('user', 'user.ID', '=', 'followers.followerid')->where('followers.id', $groupmemberlist[0]['id'])->get(); $gcmid = $folloerdetails[0]['gcm_id']; $email = $folloerdetails[0]['email']; if ($contestdetails[0]['visibility'] == 'p') { $privat_user['user_id'] = $folloerdetails[0]['follower_user_id']; $privat_user['contest_id'] = $contest_id; $privat_user['requesteddate'] = date('Y-m-d H:i:s'); $privat_user['status'] = 1; $privatecontestcnt = privateusercontestModel::where('user_id', $folloerdetails[0]['follower_user_id'])->where('contest_id', $contest_id)->get()->count(); if ($privatecontestcnt == 0) { privateusercontestModel::create($privat_user); } } if ($gcmid != '') { $Message['user_id'] = $folloerdetails[0]['follower_user_id']; $Message['title'] = 'Ding Datt'; $Message['message'] = 'You are invited for the Contest :' . $contestdetails[0]['contest_name']; $Message['contest_id'] = $contest_id; $Message = array("notification" => $Message); $DeviceId = array($gcmid); $Message = array("notification" => $Message); $this->PushNotification($DeviceId, $Message); } else { //$contestcreatedby= User::find($contestdetails[0]['createdby']); Mail::send([], array('email' => $email, 'contestcreatedby' => $contestcreatedby, 'contesttype' => $contesttype, 'contestname' => $contestname, 'contest_id' => $contest_id), function ($message) use($email, $contestcreatedby, $contesttype, $contestname, $contest_id) { $mail_body = '<body style="padding:0px;margin:-20px 0 0 0px; font-family: Arial, Helvetica, sans-serif; color: #222222; font-size:12px;"> <div style="width:550px;height:auto; border:1px solid #d5d5d5;padding:0px;margin:0px;overflow:hidden;"> <div style="display:block; margin:25px; overflow:hidden;"> <div style="display:block; padding: 10px; border: 1px solid #e5e5e5; margin:10px 0px;"> <span style="padding:0px;margin:0px;font-weight:bold;">Invitation for join the contest.</span> </div> <div style="display: block; margin: 15px;"> <h4 style="padding:0px;margin:0; font-size:14px;color:#d33030;">Contest Details:</h4> </div> <p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;"> Contest Name:</span>' . $contestname . '</p> <p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;">Contest Type:</span>' . $contesttype . '</p> <p style="margin:15px;"><span style="font-weight:bold; width:150px; float:left; display:inline-block;">Created by:</span>' . $contestcreatedby . '</p> <p style="margin-top:25px; font-size:11px; color: #999999; margin-left:15px;">This is auto generate email so please do not reply to this email.</p> <p style="margin-top:25px; font-size:11px; color: #999999; margin-left:15px;"><a href="' . URL::to('contest_info/' . $contest_id) . '" style="dislay:block;outline: none; padding:25px;margin:25px; min-height:110px; width:100%; overflow:hidden;">' . URL::to('contest_info/' . $contest_id) . '</a> </p> <div style="padding:0; margin:15px;"> <p style="padding:0px; font-weight: bold;">Thanks,</p> DingDatt</div> <a href="' . URL::to('contest_info/' . $contest_id) . '" style="dislay:block;outline: none; padding:25px;margin:25px; min-height:110px; width:100%; overflow:hidden;"> <img src="' . URL::to('assets/inner/img/DingDatt_logo_web1.png') . '" width="110" height="86" style="width:110px; padding:0px; margin:0px;" alt="DingDatt"/> </a> </div> <div style="height:25px; width:100%;"> </div> </div> </body>'; $message->setBody($mail_body, 'text/html'); $message->to($email); $message->subject('Dingdatt-Invitation for join the contest'); }); } //// $Response = array('success' => '1', 'message' => 'Invited Successfully'); $final = array("response" => $Response); return json_encode($final); } }