ticket / ticketit
Your custom ticket management system for Laravel
Installs: 87
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 388
Type:laravel-package
Requires
- php: ^7.1.3
- doctrine/dbal: ^2.10
- illuminate/support: 5.8.*
- jenssegers/date: ^3.0
- laravel/framework: 5.8.*
- laravelcollective/html: 5.8.*
- mews/purifier: ^2.0
- yajra/laravel-datatables-oracle: ^9.4
Requires (Dev)
- orchestra/testbench: 3.8.*
- phpunit/phpunit: ^7.5
- 6.0.0
- 5.0.9
- 5.0.8
- 5.0.7
- 5.0.6
- 5.0.5
- 5.0.4
- 5.0.2
- 5.0.1
- 5.0.0
- 4.0.9
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- v1.0.0
- 0.2.x-dev
- dev-ticketit-custom
This package is auto-updated.
Last update: 2025-05-10 14:45:43 UTC
README
A Laravel support ticket package with dual authentication support for staff members (Users) and customers. This package enables efficient ticket management between customers and staff.
Features
- Dual authentication system (Staff/Customers)
- Ticket management with priority levels
- Status tracking and management
- Role-based access control (Admin/Agent/Customer)
- Comment system
- Customizable views and routes
Requirements
- PHP 7.1.3+
- Laravel 5.8+
- MySQL/MariaDB
Installation
- Add the package to your composer.json:
{ "require": { "ticket/ticketit": "dev-main" } }
- Install via Composer:
composer require ticket/ticketit
- Register ServiceProvider in
config/app.php
:
'providers' => [ Ticket\Ticketit\TicketitServiceProvider::class, ],
- Publish package assets:
# Publish config php artisan vendor:publish --provider="Ticket\Ticketit\TicketitServiceProvider" --tag=ticketit-config # Publish migrations php artisan vendor:publish --provider="Ticket\Ticketit\TicketitServiceProvider" --tag=ticketit-migrations # Publish views php artisan vendor:publish --provider="Ticket\Ticketit\TicketitServiceProvider" --tag=ticketit-views # Publish routes php artisan vendor:publish --provider="Ticket\Ticketit\TicketitServiceProvider" --tag=ticketit-routes
Configuration
Models Setup
Add to your User model:
use Ticket\Ticketit\Traits\HasTickets; class User extends Authenticatable { use HasTickets; protected $fillable = [ 'name', 'email', 'password', 'ticketit_admin', 'ticketit_agent' ]; protected $casts = [ 'ticketit_admin' => 'boolean', 'ticketit_agent' => 'boolean' ]; }
Add to your Customer model:
use Ticket\Ticketit\Traits\HasTickets; class Customer extends Authenticatable { use HasTickets; protected $guard = 'customer'; protected $fillable = [ 'name', 'email', 'password', 'username' ]; }
Routes
The package provides these route groups:
// Customer Routes Route::group([ 'middleware' => ['web', 'auth:customer'], 'prefix' => 'customer/tickets', 'as' => 'customer.tickets.', 'namespace' => 'Ticket\Ticketit\Controllers' ], function () { // Basic Ticket Operations Route::get('/', 'TicketsController@index')->name('index'); Route::get('/create', 'TicketsController@create')->name('create'); Route::post('/', 'TicketsController@store')->name('store'); Route::get('/{id}', 'TicketsController@customerShow')->name('show') ->middleware('Ticket\Ticketit\Middleware\ResAccessMiddleware'); Route::post('/{ticket}/comments', 'CommentsController@store')->name('comments.store'); Route::post('/{id}/reply', 'TicketsController@customerReply') ->name('reply'); }); // Staff Routes Route::group([ 'middleware' => ['web', 'auth:web'], 'prefix' => 'staff/tickets', 'as' => 'staff.tickets.', 'namespace' => 'Ticket\Ticketit\Controllers' ], function () use ($main_route) { // Basic Staff Routes Route::middleware('Ticket\Ticketit\Middleware\StaffAuthMiddleware')->group(function() { Route::get('/', 'TicketsController@staffIndex')->name('index'); Route::get('/dashboard', 'DashboardController@staffDashboard')->name('dashboard'); Route::get('/{id}', 'TicketsController@staffShow')->name('show'); Route::post('/{ticket}/comments', 'CommentsController@store')->name('comments.store'); } }); // Admin only routes Route::middleware('Ticket\Ticketit\Middleware\AdminAuthMiddleware')->group(function() { Route::post('/{id}/assign', 'TicketsController@assignTicket')->name('admin.assign'); }); //Agent routes Route::middleware([ 'Ticket\Ticketit\Middleware\AgentAuthMiddleware', 'Ticket\Ticketit\Middleware\ResAccessMiddleware' ])->group(function() { // Ticket Management Route::get('/{id}/view', 'TicketsController@agentShow')->name('agent.show'); Route::post('/{id}/status', 'TicketsController@updateStatus')->name('status.update'); });
Database Schema
The package creates these tables:
- ticketit (tickets)
- ticketit_comments (comments)
- ticketit_categories (categories)
- ticketit_priorities (priorities)
- ticketit_statuses (statuses)
- ticketit_settings (settings)
Usage
Creating Tickets (Customers)
$ticket = new Ticket(); $ticket->subject = 'Issue Subject'; $ticket->content = 'Issue Description'; $ticket->category_id = 1; $ticket->priority_id = 1; $ticket->customer_id = auth()->guard('customer')->id(); $ticket->save();
Managing Tickets (Staff)
// Get tickets assigned to agent $tickets = Ticket::where('agent_id', auth()->id())->get(); // Update ticket status $ticket->status_id = $newStatusId; $ticket->save(); // Add comment $comment = new Comment(); $comment->content = 'Response content'; $comment->ticket_id = $ticket->id; $comment->user_id = auth()->id(); $comment->save();
License
The MIT License (MIT). See License File.