1. Go to this page and download the library: Download cavitznky/ticket-system 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/ */
cavitznky / ticket-system example snippets
use Digitalcake\TicketSystem\Traits\HasTickets;
class User extends Authenticatable
{
use HasTickets;
// ...
}
public function getTicketAdmin(): bool
{
// Define your logic to determine if a user is an admin
return $this->isAdmin(); // or any other logic
}
return [
// Number of tickets per page
'per_page' => 10,
// Other configuration options...
];
use Digitalcake\TicketSystem\Events\TicketCreated;
// In your EventServiceProvider
protected $listen = [
TicketCreated::class => [
// Your listeners here
],
];
// In your listener
public function handle(TicketCreated $event)
{
$ticket = $event->ticket;
// Do something with the ticket
}
use Digitalcake\TicketSystem\Events\TicketUpdated;
// In your EventServiceProvider
protected $listen = [
TicketUpdated::class => [
// Your listeners here
],
];
// In your listener
public function handle(TicketUpdated $event)
{
$ticket = $event->ticket;
$originalData = $event->originalData;
// Do something with the ticket and original data
}
use Digitalcake\TicketSystem\Events\TicketStatusChanged;
// In your EventServiceProvider
protected $listen = [
TicketStatusChanged::class => [
// Your listeners here
],
];
// In your listener
public function handle(TicketStatusChanged $event)
{
$ticket = $event->ticket;
$oldStatus = $event->oldStatus;
$newStatus = $event->newStatus;
// Do something with the ticket and status information
}
use Digitalcake\TicketSystem\Events\TicketResponseAdded;
// In your EventServiceProvider
protected $listen = [
TicketResponseAdded::class => [
// Your listeners here
],
];
// In your listener
public function handle(TicketResponseAdded $event)
{
$ticket = $event->ticket;
$response = $event->response;
// Do something with the ticket and response
}
use Digitalcake\TicketSystem\Events\TicketDeleted;
// In your EventServiceProvider
protected $listen = [
TicketDeleted::class => [
// Your listeners here
],
];
// In your listener
public function handle(TicketDeleted $event)
{
$ticketId = $event->ticketId;
$ticketData = $event->ticketData;
// Do something with the ticket ID and data
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.