/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @param  string $slug
  * @return Response
  */
 public function destroy($id, $slug)
 {
     $contact = PublicContact::whereId($id)->whereUnsubscribeSlug($slug)->firstOrFail();
     $email = $contact->email;
     $contact->delete();
     return view('frontend.messages.public.delete', compact('email'));
 }
 /**
  * Add a new public contact.
  *
  * @param Ticket $ticket
  * @param PublicMessageRequest $request
  * @param PublicContactRequest $contactRequest
  */
 public function addNewPublicContact(Ticket $ticket, PublicMessageRequest $request, PublicContactRequest $contactRequest)
 {
     // add a new (or update) public contact
     if ($request['public_notify'] || $request['notify']) {
         $contact = PublicContact::firstOrNew(['ticket_id' => $ticket->id, 'email' => $contactRequest['email']]);
         // create an unsubscribe slug if there isn't one
         if (is_null($contact->unsubscribe_slug)) {
             $contactRequest['unsubscribe_slug'] = rand(1000000000, 9999999999);
         }
         $contact->fill($contactRequest->all());
         $ticket->publicContacts()->save($contact);
     }
 }