Beispiel #1
0
 public function sendNotification($promoters, $event, $task, $mode)
 {
     $all_input = Input::all();
     foreach ($promoters as $ndx => $promoter) {
         $email_address = $promoter->email;
         $email_content = $all_input['email_content'];
         $email_subject = $all_input['email_subject'];
         $user = Auth::user();
         // create an autologn entry
         $autologin_token = str_random(30);
         $autologin_entry = TaskNotificationAutologin::create(['users_id' => $promoter->id, 'events_id' => $event->id, 'taskevents_id' => $task->id, 'token' => $autologin_token]);
         Mail::send('emails.promoters.notification', array('email_subject' => $email_subject, 'email_message' => $email_content, 'promoter' => $promoter, 'user' => $user, 'event' => $event, 'task' => $task, 'token' => $autologin_token), function ($message) use($promoter, $email_subject) {
             $message->to($promoter->email, $promoter->username)->subject($email_subject);
         });
         eerror_log($mode . ' Sent mail to ' . $promoter->email);
         Debugbar::info($mode . ' Sent mail to ' . $promoter->email . ' task group_id: ' . $task->group_id . ' type ' . $promoter->types()->get());
     }
 }
Beispiel #2
0
 public function getNotifications($autologin_token)
 {
     eerror_log('Task Notifications autologin' . json_encode($autologin_token));
     // logout
     Auth::logout();
     $missing_sales_autologin_entry = TaskNotificationAutologin::where('token', $autologin_token)->first();
     if (!$missing_sales_autologin_entry) {
         return Redirect::To('/');
     } else {
         $user = User::find($missing_sales_autologin_entry->users_id);
         Auth::loginUsingId($user->id);
         $event_id = $missing_sales_autologin_entry->events_id;
         $task_id = $missing_sales_autologin_entry->taskevents_id;
         $missing_sales_autologin_entry->update(['token' => null]);
         return Redirect::to('/my-events/' . $event_id . '/dashboard?taskId=' . $task_id);
     }
 }