Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ticket Laravel Package

masumbd/ticket

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require masumbd/ticket
    php artisan vendor:publish --provider="Masum1008\Ticket\TicketServiceProvider" --tag="migrations"
    php artisan vendor:publish --provider="Masum1008\Ticket\TicketServiceProvider" --tag="config"
    php artisan migrate
    
  2. Publish Assets

    php artisan vendor:publish --provider="Masum1008\Ticket\TicketServiceProvider" --tag="public"
    php artisan vendor:publish --provider="Masum1008\Ticket\TicketServiceProvider" --tag="views"
    
  3. Add Routes Include in routes/web.php:

    Route::prefix('ticket')->group(function () {
        require __DIR__ . '/ticket.php';
    });
    
  4. First Use Case

    • Register a user as an agent or admin via php artisan ticker:make-admin or php artisan ticker:make-agent.
    • Log in as a regular user and create a ticket via /ticket/create.

Implementation Patterns

Core Workflows

  1. Ticket Creation

    • Users create tickets via a form (published at resources/views/vendor/ticket/).
    • Customize the form by extending Masum1008\Ticket\Http\Requests\CreateTicketRequest.
  2. Agent Assignment

    • Auto-assignment logic in Masum1008\Ticket\Services\TicketService::assignAgent().
    • Override by extending the service or modifying the department_agent table.
  3. Role-Based Permissions

    • Use middleware (Masum1008\Ticket\Http\Middleware\CheckTicketRole) to restrict access.
    • Example:
      Route::middleware(['auth', 'ticket.role:agent'])->group(function () {
          // Agent-only routes
      });
      
  4. Localization

    • Load language files from resources/lang/vendor/ticket/ or override in app/lang/vendor/ticket/.
    • Set locale in config/ticket.php:
      'locale' => 'en',
      
  5. Dashboard Integration

    • Extend the admin dashboard by overriding resources/views/vendor/ticket/dashboard.blade.php.
    • Add custom stats via Masum1008\Ticket\Repositories\TicketRepository::getStats().

Integration Tips

  • Custom Fields: Extend the ticket table via migrations and update the form in resources/views/vendor/ticket/create.blade.php.
  • Email Notifications: Override Masum1008\Ticket\Events\TicketCreated to send custom emails.
  • API Access: Use the Masum1008\Ticket\Http\Controllers\Api controllers for REST endpoints.

Gotchas and Tips

Pitfalls

  1. Archived Status

    • No active maintenance; expect no bug fixes or Laravel 9+ compatibility.
    • Fork or migrate to alternatives like Laravel Support if long-term use is planned.
  2. Middleware Conflicts

    • Ensure ticket.role middleware is placed after auth in route groups to avoid permission errors.
  3. Auto-Assignment Logic

    • The agent assignment relies on department_agent table. Verify data integrity if tickets aren’t auto-assigned.
    • Debug with:
      \Masum1008\Ticket\Services\TicketService::getLeastBusyAgent($departmentId);
      
  4. Asset Publishing

    • If CSS/JS fails to load, republish assets:
      php artisan vendor:publish --tag="public" --force
      

Debugging

  • Ticket Not Saving? Validate the CreateTicketRequest payload and check for validation errors in resources/views/vendor/ticket/errors.blade.php.

  • Permission Denied? Verify user roles in users table (role column: user, agent, or admin).

Extension Points

  1. Custom Ticket Statuses

    • Extend the statuses table and update Masum1008\Ticket\Models\Ticket::getStatusOptions().
  2. Attachment Handling

    • Override Masum1008\Ticket\Http\Controllers\TicketController::uploadAttachment() for custom storage (e.g., S3).
  3. Email Templates

    • Modify resources/views/vendor/ticket/emails/ or override the Masum1008\Ticket\Mail\TicketMailer class.
  4. API Responses

    • Extend Masum1008\Ticket\Http\Resources\TicketResource for custom API payloads.

Config Quirks

  • Department-Based Assignment Ensure config/ticket.php has auto_assign_agents set to true and departments are configured:

    'departments' => [
        1 => 'General',
        2 => 'Technical',
    ],
    
  • Localization Fallback Set fallback_locale in config/ticket.php to avoid missing translations:

    'fallback_locale' => 'en',
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor