/** * show Contact. * * @param Business $business Business holding the Contact * @param Contact $contact Desired Contact to show * * @return Response Rendered view of Contact */ public function show(Business $business, Contact $contact) { logger()->info(__METHOD__); logger()->info(sprintf('businessId:%s contactId:%s', $business->id, $contact->id)); $this->authorize('manage', $contact); // BEGIN $memberSince = $business->contacts()->find($contact->id)->pivot->created_at; $appointments = $contact->appointments()->orderBy('start_at')->ofBusiness($business->id)->active()->get(); return view('user.contacts.show', compact('business', 'contact', 'appointments', 'memberSince')); }
private function putUserGuestContactOf(Contact $contact, Business $business) { $business->contacts()->save($contact); }
/** * Update notes from pivot table. * * @param Business $business * @param Contact $contact * @param string $notes * * @return void */ protected function updateNotes(Business $business, Contact $contact, $notes = null) { if ($notes) { $business->contacts()->find($contact->id)->pivot->update(['notes' => $notes]); } }