withContact($contact); } /** * Update the specified resource in storage. * * @param IntroductionsRequest $request * @param Contact $contact * @return \Illuminate\Http\Response */ public function update(IntroductionsRequest $request, Contact $contact) { // Store the contact that allowed this encounter to happen in the first // place if ($request->get('metThroughId') !== null) { try { Contact::where('account_id', auth()->user()->account_id) ->findOrFail($request->get('metThroughId')); } catch (ModelNotFoundException $e) { return $this->handleModelNotFound($e); } $contact->first_met_through_contact_id = $request->get('metThroughId'); } else { $contact->first_met_through_contact_id = null; } $contact->removeSpecialDate('first_met'); if ($request->is_first_met_date_known == 'known') { $specialDate = $contact->setSpecialDate('first_met', $request->input('first_met_year'), $request->input('first_met_month'), $request->input('first_met_day')); if ($request->addReminder == 'on') { $specialDate->setReminder('year', 1, trans('people.introductions_reminder_title', ['name' => $contact->first_name])); } } if ($request->first_met_additional_info != '') { $contact->first_met_additional_info = $request->get('first_met_additional_info'); } else { $contact->first_met_additional_info = null; } $contact->save(); return redirect()->route('people.show', $contact) ->with('success', trans('people.introductions_update_success')); } /** * Remove the specified resource from storage. * * @param Contact $contact * @param Gift $gift * @return \Illuminate\Http\Response */ public function destroy(Contact $contact, Gift $gift) { $gift->delete(); return redirect()->route('people.show', $contact) ->with('success', trans('people.gifts_delete_success')); } }