Example #1
0
 });
 Route::post('send', function () {
     $notice = new Notification();
     $notice->event = Input::get('event');
     $notice->task_id = Input::get('task_id');
     $notice->load('Task');
     $notice->task->creator_id = Input::get('creator_id') == "" ? NULL : Input::get('creator_id');
     $notice->task->claimed_id = Input::get('claimed_id') == "" ? NULL : Input::get('claimed_id');
     $notice->task->load('creator');
     $notice->task->load('claimer');
     $status = false;
     $back_url = URL::previous() . '?' . http_build_query(Request::all());
     $data = ['task' => $notice->task, 'extra' => '<a style="position: fixed; bottom:0; text-align:center;padding:25px 0;background-color:#FF6666;width:100%;color:white;font-family: Montserrat, Arial, sans-serif;text-transform:uppercase;font-size:12px;letter-spacing:1px;" href="' . $back_url . '">Back to Admin</a>'];
     // award info
     if (Input::get('event') == Notification::NOTIFICATION_NEW_AWARD) {
         $data['award'] = new Award(['user_id' => Auth::id(), 'project_id' => Project::getRandomID(), 'name' => Input::get('award_type', Award::AWARD_CLAIMED_5)]);
     }
     // get emails
     $emails = explode(',', Input::get('emails', '*****@*****.**'));
     // filter fake ones
     $emails = array_filter($emails, function ($a) {
         if (filter_var($a, FILTER_VALIDATE_EMAIL)) {
             return $a;
         }
     });
     $pre_render = Input::get('pre_render', false) == "on" ? true : false;
     if (Input::get('view')) {
         return $notice->renderEmail($data)->downloadHtml();
     }
     // get the subject
     $subject = Input::get('subject', Auth::user()->getName() . " Halp Email Test:" . $notice->event . " " . uniqid());