public function resendBallot($id) { $voter = Voter::find($id); if ($voter->voted == true) { return Redirect::to('/dashboard/voter')->with('message', 'User already voted. Cannot resend ballot'); } $voter->key->delete(); $key = Key::createKey($voter); //$this->sendEmail($voter->email,"Hello, ".$voter->first_name. ', http://election.yesalumnibd.org/ballot?key='.$key->key); $this->sendEmail($voter->email, "Dear YES Alumni,\n\n \nHope you are well. This is your official email for voting. The link below has been uniquely generated in your name; so you can only vote once. Click on the URL, and you will be directed to the ballot page where you can cast your vote.\n \nPlease note that the voting system will ONLY be active from 12:00AM to 11:59PM of Tuesday, 26 July, 2016. You must cast your vote within this time window.\n \nAfter you have submitted your votes, you will be lead to an end page - that is the confirmation of your vote. If you face any problems during voting, please contact me at the given information below; the necessary actions will be taken.\n \nThe results will be published after 5:00PM on Wednesday, 27 July, 2016.\n\n" . 'The ballot link: http://election.yesalumnibd.org/ballot?key=' . $key->key . "\n\n \nThis event marks a great significance in the practice of democracy for the YES Alumni association in Bangladesh. Wishing you and the association all the very best!\n\n \nBest regards,\n\n \nMuhammad Maruf Ibne Wali\n \nElection Commissioner\n \nYES Alumni EC Elections 2016\n \nPhone: 01716788220\n \nemail: marufwali@yahoo.com"); return Redirect::to('/dashboard/voter')->with('message', 'Ballot was resent to ' . $voter->first_name . '. Link: election.yesalumnibd.org/ballot?key=' . $key->key); }
/** * Bootstrap any application services. * * @return void */ public function boot() { Voter::created(function ($voter) { Key::createKey($voter); }); }