validate([ 'group_type' => 'required', 'first_name' => 'required|min:2', 'last_name' => 'required|min:2', 'email' => 'required|string|email|max:255', 'phone' => 'required|min:7', 'comments' => 'nullable|min:2', // 'location_of_interest' => 'nullable', // 'g-recaptcha-response' => 'required|captcha', ]); // Take the array of the other_locations_of_interest and converts to a comma separated list. if ($request->input('location_of_interest')) { $location_of_interest_string = ''; foreach ($request->input('location_of_interest') as $convertToComma) { $location_of_interest_string .= $convertToComma . ', '; } $location_of_interest = substr($location_of_interest_string, 0, -1); $mailTo = 'missions@boldhope.org'; Mail::to($mailTo)->bcc('chris@boldhope.org') ->send(new TripInquireHomeEmail( $request->input('group_type'), $request->input('first_name'), $request->input('last_name'), $request->input('email'), $request->input('phone'), $request->input('comments'), $location_of_interest )); } else { $mailTo = 'missions@boldhope.org'; Mail::to($mailTo)->bcc('chris@boldhope.org') ->send(new TripInquireHomeEmail( $request->input('group_type'), $request->input('first_name'), $request->input('last_name'), $request->input('email'), $request->input('phone'), $request->input('comments'), null )); } return back()->with('success', 'Your inquiry has been sent. We will be in contact with you soon.'); } }