public function sendReminder(Request $request, $id, $user_id, AppMailer $mailer) { // find the Plan $plan = Plan::find($id); // get the recipient $recipient = User::find($user_id); // what is the role of this user in this plan? $role = 'not set'; if (isset($request->role)) { $role = $request->role; } // verify validity of this request if ($plan && $plan->isFuture() && Auth::user()->ownsPlan($id)) { $mailer->planReminder($recipient, $plan, $role); flash('Email sent to ' . $recipient->fullName); return redirect()->back(); } flash('Plan not found!'); return redirect()->back(); }