Beispiel #1
0
 public function deleteHelp(Request $request, $id)
 {
     $help = HelpingCommittee::findOrFail($id);
     foreach ($help->users as $user) {
         $name = $user->name;
         $email = $user->email;
         $helptitle = $help->activity->event->title;
         Mail::queue('emails.committeehelpnotneeded', ['user' => $user, 'help' => $help], function ($m) use($name, $email, $helptitle) {
             $m->replyTo('*****@*****.**', 'S.A. Proto');
             $m->to($email, $name);
             $m->subject('The activity ' . $helptitle . ' doesn\'t need your help anymore.');
         });
     }
     foreach (ActivityParticipation::withTrashed()->where('committees_activities_id', $help->id)->get() as $participation) {
         $participation->delete();
     }
     $help->delete();
     $request->session()->flash('flash_message', 'Removed ' . $help->committee->name . ' as helping committee.');
     return Redirect::back();
 }