定制 ticket/ticketit 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ticket/ticketit

Composer 安装命令:

composer require ticket/ticketit

包简介

Your custom ticket management system for Laravel

README 文档

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

  1. Add the package to your composer.json:
{
    "require": {
        "ticket/ticketit": "dev-main"
    }
}
  1. Install via Composer:
composer require ticket/ticketit
  1. Register ServiceProvider in config/app.php:
'providers' => [
    Ticket\Ticketit\TicketitServiceProvider::class,
],
  1. 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.

ticket/ticketit 适用场景与选型建议

ticket/ticketit 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 88 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 11 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「support」 「laravel」 「ticket」 「helpdesk」 「your-keywords」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ticket/ticketit 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ticket/ticketit 我们能提供哪些服务?
定制开发 / 二次开发

基于 ticket/ticketit 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 88
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 380
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-01