marshmallow-packages / zoho-desk

Laravel Zoho Desk connector
MIT License
0 stars 0 forks source link

Provide some documentation #6

Closed iamharisali closed 3 years ago

iamharisali commented 3 years ago

Can you please provide some kind of documentation on how to use this package inside code?

use Marshmallow\ZohoDesk\Facades\Contact;
use Marshmallow\ZohoDesk\Facades\ZohoDesk;

$contact = Contact::findOrCreate('haris@iddigital.com.au', [
            'firstName' => 'Haris',
            'lastName'  => 'Ali'
        ]);

        $response = Ticket::create($contact, Carbon::today(), null, [
            "cf"=> array(
                'cf_enquiry_source' => "Course Search Platforms",
                'cf_enquiry_source_details' => "coursesearchnow.com",
                'cf_enquiry_type' => "Student",
                'cf_country' => "India",
            ),
            'description' => "Enquiry for B2B Business",
            'subject'   => 'AECC',
            'status' => "Open"

        ]);

This is what I tried but it doesn't seem to work properrly

iamharisali commented 3 years ago

Any News here?

stefvanesch commented 3 years ago

@iamharisali sorry! I mist your issue completely. This package is still work in progress and so is the documentation. We've just added two new methods to set the due date on a ticket and add a comment to a ticket. Below you will find an example on how we use it in one of our projects.

Hope this helps!!

public function addToZoho()
{
      if (ZohoDesk::notActive()) {
           return;
     }

      $product = ($this->product) ? ZohoProduct::findOrCreate($this->product->fullname()) : null;

      $contact = Contact::findOrCreate($this->email, [
         'lastName' => $this->last_name,
         'firstName' => $this->first_name,
         'email' => $this->email,
         'phone' => $this->phonenumber,
         'city' => $this->city,
         'street' => trim($this->street . ' ' . $this->house_number),
         'zip' => $this->zipcode,
         'cf' => [
             'cf_woonplaats' => $this->city,
         ],
     ]);

      $ticket = Ticket::create($contact, now()->addMinutes(15), $product, [
         'description' => $this->comment,
         'subject' => __('Your request at') . ' ' . config('app.name'),
         'email' => $this->email,
         'phone' => $this->phonenumber,
         'cf' => [
             'cf_link_to_cms' => $cms_url,
             'cf_referer' => $this->referer,
             'cf_source' => $conversion->source,
         ],
     ]);
}