PHP code example of sync667 / zendesk-laravel-med
1. Go to this page and download the library: Download sync667/zendesk-laravel-med library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sync667 / zendesk-laravel-med example snippets
// config/app.php
'providers' => [
...
Huddle\Zendesk\Providers\ZendeskServiceProvider::class,
...
];
// config/app.php
'aliases' => [
..
'Zendesk' => Huddle\Zendesk\Facades\Zendesk::class,
];
// Get all tickets
Zendesk::tickets()->findAll();
// Create a new ticket
Zendesk::tickets()->create([
'subject' => 'Subject',
'comment' => [
'body' => 'Ticket content.'
],
'priority' => 'normal'
]);
// Update multiple tickets
Zendesk::ticket([123, 456])->update([
'status' => 'urgent'
]);
// Delete a ticket
Zendesk::ticket(123)->delete();
use Huddle\Zendesk\Services\ZendeskService;
class MyClass {
public function __construct(ZendeskService $zendesk_service) {
$this->zendesk_service = $zendesk_service;
}
public function addTicket() {
$this->zendesk_service->tickets()->create([
'subject' => 'Subject',
'comment' => [
'body' => 'Ticket content.'
],
'priority' => 'normal'
]);
}
}
bash
php artisan vendor:publish --provider="Huddle\Zendesk\Providers\ZendeskServiceProvider"