1. Go to this page and download the library: Download aichadigital/laratickets 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/ */
use AichaDigital\Laratickets\Services\TicketService;
use AichaDigital\Laratickets\Enums\Priority;
$ticketService = app(TicketService::class);
$ticket = $ticketService->createTicket([
'subject' => 'Database connection issue',
'description' => 'Cannot connect to production database',
'priority' => Priority::HIGH,
'department_id' => 1,
], $user);
use AichaDigital\Laratickets\Services\EscalationService;
$escalationService = app(EscalationService::class);
$escalation = $escalationService->requestEscalation(
$ticket,
$targetLevel, // TicketLevel model
'Issue
use AichaDigital\Laratickets\Services\RiskAssessmentService;
use AichaDigital\Laratickets\Enums\RiskLevel;
$riskService = app(RiskAssessmentService::class);
$assessment = $riskService->assessRisk(
$ticket,
$assessor, // Must be Level III or IV
RiskLevel::CRITICAL,
'Affects production systems for 10k+ users'
);
// Auto-escalates if risk is CRITICAL
namespace App\Laratickets\Authorization;
use AichaDigital\Laratickets\Contracts\TicketAuthorizationContract;
use Silber\Bouncer\BouncerFacade as Bouncer;
class MyTicketAuthorization implements TicketAuthorizationContract
{
public function canViewTicket($user, Ticket $ticket): bool
{
return Bouncer::can('view-tickets')
|| $user->id === $ticket->created_by;
}
// Implement other methods...
}
use AichaDigital\Laratickets\Events\TicketCreated;
class SendTicketCreatedNotification
{
public function handle(TicketCreated $event): void
{
$ticket = $event->ticket;
// Send notification to level I agents
Notification::send(
$this->getLevelIAgents($ticket->department_id),
new NewTicketNotification($ticket)
);
}
}
bash
php artisan laratickets:install --seed
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.