kordy/ticketit
Archived Laravel helpdesk/ticketing system (Laravel 5.1–8). Adds user/agent/admin roles, ticket creation and comments, configurable permissions, auto agent assignment, admin dashboard with stats, localization packs, and simple editor with image uploads.
Installation
composer require kordy/ticketit
php artisan vendor:publish --provider="Kordy\Ticketit\TicketitServiceProvider"
php artisan migrate
php artisan ticketit:install
php artisan ticketit:install to configure default roles (users, agents, admins) and seed initial data.First Use Case: Creating a Ticket
php artisan vendor:publish --tag=ticketit-views
routes/web.php:
Route::get('/create-ticket', 'TicketitController@create')->name('ticketit.create');
Route::post('/create-ticket', 'TicketitController@store')->name('ticketit.store');
@ticketit
Ticket Creation & Management
create.blade.php and show.blade.php).Route::get('/agent/tickets', 'AgentController@index').Route::get('/admin/ticketit', 'AdminController@index').Auto-Assignment Logic
config/ticketit.php:
'departments' => [
'technical' => ['agents' => [1, 2]], // Agent IDs
'billing' => ['agents' => [3]],
],
assignToLeastBusyAgent() method in custom logic:
$ticket->assignToLeastBusyAgent('technical');
Localization
config/app.php:
'locale' => 'en', // or 'ar', 'pt_BR', etc.
{{ __('ticketit::messages.ticket_created') }}
Dashboard Integration
// In a service provider
Event::listen('ticketit.admin.dashboard', function ($dashboard) {
$dashboard->addWidget(new \Kordy\Ticketit\Widgets\CustomWidget());
});
Text Editor & Attachments
config/ticketit.php):
'editor' => [
'enabled' => true,
'config' => [
'filebrowserImageUploadUrl' => route('ticketit.upload'),
],
],
UploadController (published routes include /upload).Archived Package Risks
Role/Department Mismatches
config/ticketit.php mappings:
'departments' => [
'tech' => ['agents' => [1, 2]], // Ensure agent IDs exist in `users` table.
],
dd(\Kordy\Ticketit\Models\Department::with('agents')->get());
Migration Conflicts
users or roles tables. Run:
php artisan vendor:publish --tag=ticketit-migrations
Then manually merge changes (e.g., ticketit_users pivot table).CKEditor Uploads
storage/app/public:
php artisan storage:link
config/filesystems.php has:
'disks' => [
'public' => [
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
],
Localization Caching
php artisan view:clear
php artisan cache:clear
Log Auto-Assignment
Add to app/Providers/AppServiceProvider.php:
public function boot()
{
\Kordy\Ticketit\Events\TicketAssigned::listen(function ($event) {
\Log::info('Ticket assigned', ['ticket' => $event->ticket, 'agent' => $event->agent]);
});
}
Override Assignment Logic
Extend the AssignToLeastBusyAgent trait:
namespace App\Extensions;
use Kordy\Ticketit\Traits\AssignToLeastBusyAgent as BaseTrait;
trait CustomAssignToLeastBusyAgent
{
use BaseTrait;
protected function getLeastBusyAgent($department)
{
// Custom logic here
return parent::getLeastBusyAgent($department);
}
}
Test Routes
Use php artisan route:list | grep ticketit to verify published routes. Common missing routes:
/agent/tickets/admin/ticketitCustom Fields
Extend the Ticket model:
namespace App;
use Kordy\Ticketit\Models\Ticket as BaseTicket;
class Ticket extends BaseTicket
{
protected $casts = [
'priority' => 'integer', // Example custom field
];
}
Webhooks Listen for ticket events:
\Kordy\Ticketit\Events\TicketCreated::listen(function ($event) {
// Send Slack/email notification
});
API Endpoints Use Laravel’s API resources to expose tickets:
Route::apiResource('tickets', 'TicketApiController');
namespace App\Http\Controllers;
use Kordy\Ticketit\Models\Ticket;
use App\Http\Resources\TicketResource;
class TicketApiController extends Controller
{
public function index()
{
return TicketResource::collection(Ticket::all());
}
}
How can I help you explore Laravel packages today?