PHPackages                             renatoxm/laravel-ticket - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. renatoxm/laravel-ticket

ActiveLibrary[Admin Panels](/categories/admin)

renatoxm/laravel-ticket
=======================

Laravel Ticket System, to help you manage your tickets eaisly

v2.0.1(2y ago)12.8k↓50%MITPHPPHP ^8.1

Since Sep 12Pushed 2y agoCompare

[ Source](https://github.com/renatoxm/laravel-ticket)[ Packagist](https://packagist.org/packages/renatoxm/laravel-ticket)[ Docs](https://github.com/Renatoxmx/laravel-ticket)[ Fund](https://www.buymeacoffee.com/ousid)[ Fund](https://ko-fi.com/ousid)[ RSS](/packages/renatoxm-laravel-ticket/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (16)Used By (0)

Laravel-ticket
==============

[](#laravel-ticket)

Backend API to handle your ticket system.

[![Latest Version on Packagist](https://camo.githubusercontent.com/23d03c3c5c0ae68a39db297e5a5f8f7cb2d66f138410cc1b1e9623163bc7afbb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72656e61746f786d2f6c61726176656c2d7469636b65742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/renatoxm/laravel-ticket)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Tests](https://camo.githubusercontent.com/c0a612933705def46a3b49f0d6c923473a5380312074b2f79ee0d4be1b22dc2a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72656e61746f786d2f6c61726176656c2d7469636b65742f74657374732e796d6c3f6272616e63683d6d61696e)](https://github.com/renatoxm/laravel-ticket/actions/workflows/tests.yml)[![StyleCI](https://camo.githubusercontent.com/bbfac79be614c586c1304b3531aa598f757ab6709d0f6c8d8f09e50b6ab272cf/68747470733a2f2f7374796c6563692e696f2f7265706f732f3639303733333333382f736869656c643f6272616e63683d6d61696e)](https://styleci.io/repos/690733338)[![Total Downloads](https://camo.githubusercontent.com/55d7e64111427e46084beb56fe6a7996d129cf1fd6da1d727441cfe2caf06c2b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72656e61746f786d2f6c61726176656c2d7469636b65742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/renatoxm/laravel-ticket)

- [Introduction](#introduction)
- [Installation](#installation)
- [Configuration](#configuration)
- [Preparing your model](#preparing-your-model)
- [Model customization](#model-customization)
- [Usage](#usage)
    - [Ticket Table Structure](#ticket-table-structure)
    - [Comment Table Structure](#comment-table-structure)
    - [Label Table Structure](#label-table-structure)
    - [Category Table Structure](#category-table-structure)
- [API Methods](#api-methods)
    - [Ticket API Methods](#ticket-api-methods)
    - [Ticket Relationship API Methods](#ticket-relationship-api-methods)
    - [Ticket Scopes](#ticket-scopes)
    - [Category &amp; Label Scopes](#category--label-scopes)
- [Handling File Upload](#handling-file-upload)
- [Event System](#event-system)
- [Testing](#testing)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Security Vulnerabilities](#security-vulnerabilities)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

**Laravel Ticket** package, is a Backend API to handle your ticket system, with an easy way. It was forked from [CoderFlex Laravel-ticket](https://github.com/coderflexx/laravel-ticket) and refactored to allow model updates and be more flexible to match your app requirements.

**Main differences:**

- All models can be copied and altered to meet your requirements; all you need to do is change the paths in config/laravel-ticket.php.
- Tickets can be assigned to a user model, groups, or teams via a polymorphic many-to-many relationship.
- Messages model was renamed to Comments model for semantic purposes.
- Event support is provided for changes of state in both the Ticket and Comment models.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require Renatoxm/laravel-ticket
```

Configuration
-------------

[](#configuration)

You can publish the config file with:

```
php artisan vendor:publish --tag="ticket-config"
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="ticket-migrations"
```

Before Running the migration, you may publish the config file, and make sure the current tables does not make a conflict with your existing application, and once you are happy with the migration table, you can run

```
php artisan migrate
```

Preparing your model
--------------------

[](#preparing-your-model)

Add `HasTickets` trait into your `User` model, along with `CanUseTickets` interface

```
...
use Renatoxm\LaravelTicket\Concerns\HasTickets;
use Renatoxm\LaravelTicket\Contracts\CanUseTickets;
...
class User extends Model implements CanUseTickets
{
    ...
    use HasTickets;
    ...
}
```

Model customization
-------------------

[](#model-customization)

You can copy one or more of the package models to your `App/Models` folder to customize them to suit your needs. All you need to do is change the class paths in your config/laravel-ticket.php and you are good to go.

```
    'model' => [
        'category' => Renatoxm\LaravelTicket\Models\Category::class,
        'label' => Renatoxm\LaravelTicket\Models\Label::class,
        'comment' => Renatoxm\LaravelTicket\Models\Comment::class,
        'ticket' => Renatoxm\LaravelTicket\Models\Ticket::class,
    ],
```

Usage
-----

[](#usage)

The Basic Usage of this package, is to create a `ticket`, then associate the `labels` and the `categories` to it.

You can associate as many as `categories`/`labels` into a single ticket.

Here is an example

```
use Renatoxm\LaravelTicket\Models\Ticket;
use Renatoxm\LaravelTicket\Models\Category;
use Renatoxm\LaravelTicket\Models\Label;

...
public function store(Request $request)
{
    /** @var User */
    $user = Auth::user();

    $ticket = $user->tickets()
                    ->create($request->validated());

    $category = Category::first();
    $label = Label::first();

    $ticket->attachCategories($category);
    $ticket->attachLabels($label);

    // or you can create the categories & the tickets directly by:
    // $ticket->categories()->create(...);
    // $ticket->labels()->create(...);

    return redirect(route('tickets.show', $ticket->uuid))
            ->with('success', __('Your Ticket Was created successfully.'));
}

public function createLabel()
{
    // If you create a label seperated from the ticket and wants to
    // associate it to a ticket, you may do the following.
    $label = Label::create(...);

    $label->tickets()->attach($ticket);

    // or maybe
    $label->tickets()->detach($ticket);
}

public function createCategory()
{
    // If you create a category/categories seperated from the ticket and wants to
    // associate it to a ticket, you may do the following.
    $category = Category::create(...);

    $category->tickets()->attach($ticket);

    // or maybe
    $category->tickets()->detach($ticket);
}
...
```

### Ticket Table Structure

[](#ticket-table-structure)

Column NameTypeDefaultID`integer``NOT NULL`UUID`string``NULL`user\_id`integer``NOT NULL`title`string``NOT NULL`comment`string``NULL`priority`string``low`status`string``open`is\_resolved`boolean``false`is\_locked`boolean``false`assigned\_to`integer``NULL`created\_at`timestamp``NULL`updated\_at`timestamp``NULL`### Comment Table Structure

[](#comment-table-structure)

Column NameTypeDefaultID`integer``NOT NULL`user\_id`integer``NOT NULL`ticket\_id`integer``NOT NULL`comment`string``NULL`created\_at`timestamp``NULL`updated\_at`timestamp``NULL`### Label Table Structure

[](#label-table-structure)

Column NameTypeDefaultID`integer``NOT NULL`name`string``NULL`slug`string``NULL`is\_visible`boolean``false`created\_at`timestamp``NULL`updated\_at`timestamp``NULL`### Category Table Structure

[](#category-table-structure)

Column NameTypeDefaultID`integer``NOT NULL`name`string``NULL`slug`string``NULL`is\_visible`boolean``false`created\_at`timestamp``NULL`updated\_at`timestamp``NULL`API Methods
-----------

[](#api-methods)

### Ticket API Methods

[](#ticket-api-methods)

The `ticket` model came with handy methods to use, to make your building process easy and fast, and here is the list of the available **API**:

MethodArgumentsDescriptionExampleChainable`archive``void`archive the ticket`$ticket->archive()`✓`close``void`close the ticket`$ticket->close()`✓`reopen``void`reopen a closed ticket`$ticket->reopen()`✓`markAsResolved``void`mark the ticket as resolved`$ticket->markAsResolved()`✓`markAsLocked``void`mark the ticket as locked`$ticket->markAsLocked()`✓`markAsUnlocked``void`mark the ticket as unlocked`$ticket->markAsUnlocked()`✓`markAsArchived``void`mark the ticket as archived`$ticket->markAsArchived()`✓`closeAsResolved``void`close the ticket and marked it as resolved`$ticket->closeAsResolved()`✓`closeAsUnresolved``void`close the ticket and marked it as unresolved`$ticket->closeAsUnresolved()`✓`reopenAsUnresolved``void`reopen the ticket and marked it as unresolved`$ticket->reopenAsUnresolved()`✓`isArchived``void`check if the ticket archived`$ticket->isArchived()`✗`isOpen``void`check if the ticket open`$ticket->isOpen()`✗`isClosed``void`check if the ticket closed`$ticket->isClosed()`✗`isResolved``void`check if the ticket has a resolved status`$ticket->isResolved()`✗`isUnresolved``void`check if the ticket has an unresolved status`$ticket->isUnresolved()`✗`isLocked``void`check if the ticket is locked`$ticket->isLocked()`✗`isUnlocked``void`check if the ticket is unlocked`$ticket->isUnlocked()`✗`assignTo``void`assign ticket to a user`$ticket->assignTo($user)` or `$ticket->assignTo(2)`✓`makePriorityAsLow``void`make ticket priority as low`$ticket->makePriorityAsLow()`✓`makePriorityAsNormal``void`make ticket priority as normal`$ticket->makePriorityAsNormal()`✓`makePriorityAsHigh``void`make ticket priority as high`$ticket->makePriorityAsHigh()`✓The **Chainable** column, is showing the state for the method, that if it can be chained or not, something like

```
    $ticket->archive()
            ->close()
            ->markAsResolved();
```

### Ticket Relationship API Methods

[](#ticket-relationship-api-methods)

The `ticket` model has also a list of methods for interacting with another related models

MethodArgumentsDescriptionExample`attachLabels``mixed` ID, `array` attributes, `bool` touchassociate labels into an existing ticket`$ticket->attachLabels([1,2,3,4])``syncLabels``Model/array` IDs, `bool` detouchingassociate labels into an existing ticket`$ticket->syncLabels([1,2,3,4])``attachCategories``mixed` ID, `array` attributes, `bool` touchassociate categories into an existing ticket`$ticket->attachCategories([1,2,3,4])``syncCategories``Model/array` IDs, `bool` detouchingassociate categories into an existing ticket`$ticket->syncCategories([1,2,3,4])``comment``string` commentadd new comment on an existing ticket`$ticket->comment('A comment in a ticket')``commentAsUser``Model/null` user, `string` commentadd new comment on an existing ticket as a different user`$ticket->commentAsUser($user, 'A comment in a ticket')`> The `attachCategories` and `syncCategories` methods, is an alternative for `attach` and `sync` laravel methods, and if you want to learn more, please take a look at this [link](https://laravel.com/docs/9.x/eloquent-relationships#attaching-detaching)

The `commentAsUser` accepts a user as a first argument, if it's null, the **authenticated** user will be user as default.

### Ticket Scopes

[](#ticket-scopes)

The `ticket` model has also a list of scopes to begin filter with.

MethodArgumentsDescriptionExample`closed``void`get the closed tickets`Ticket::closed()->get()``opened``void`get the opened tickets`Ticket::opened()->get()``archived``void`get the archived tickets`Ticket::archived()->get()``unArchived``void`get the unArchived tickets`Ticket::unArchived()->get()``resolved``void`get the resolved tickets`Ticket::resolved()->get()``locked``void`get the locked tickets`Ticket::locked()->get()``unlocked``void`get the unlocked tickets`Ticket::unlocked()->get()``withLowPriority``void`get the low priority tickets`Ticket::withLowPriority()->get()``withNormalPriority``void`get the normal priority tickets`Ticket::withNormalPriority()->get()``withHighPriority``void`get the high priority tickets`Ticket::withHighPriority()->get()``withPriority``string` $priorityget the withPriority tickets`Ticket::withPriority('critical')->get()`### Category &amp; Label Scopes

[](#category--label-scopes)

MethodArgumentsDescriptionExample`visible``void`get the visible model records`Label::visible()->get()``hidden``void`get the hidden model records`Category::visible()->get()`Handling File Upload
--------------------

[](#handling-file-upload)

This package doesn't come with file upload feature (yet) Instead you can use [laravel-medialibrary](https://github.com/spatie/laravel-medialibrary) by **Spatie**, to handle file functionality.

The steps are pretty straight forward, all what you need to do is the following.

Extends the `Ticket` model, by creating a new model file in your application by

```
php artisan make:model Ticket
```

Then extend the base `Ticket Model`, then use `InteractWithMedia` trait by spatie package, and the interface `HasMedia`:

```
namespace App\Models\Ticket;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;

class Ticket extends \Renatoxm\LaravelTicket\Models\Ticket implements HasMedia
{
    use InteractsWithMedia;
}
```

The rest of the implementation, head to [the docs](https://spatie.be/docs/laravel-medialibrary/v10/introduction) of spatie package to know more.

Event system
------------

[](#event-system)

All events are located in the `Renatoxm\laravel-ticket\Events` namespace.

### Ticket events

[](#ticket-events)

The following events are dispatched as a result of Eloquent events being fired.

- TicketCreating
- TicketCreated
- TicketSaving
- TicketSaved
- TicketUpdating
- TicketUpdated
- TicketDeleting
- TicketDeleted

### Comment events

[](#comment-events)

The following events are dispatched as a result of Eloquent events being fired.

- CommentCreating
- CommentCreated
- CommentSaving
- CommentSaved
- CommentUpdating
- CommentUpdated
- CommentDeleting
- CommentDeleted

### Consuming events

[](#consuming-events)

```
use Renatoxm\LaravelTicket\Events\TicketCreated;

Event::listen(function (TicketCreated $event) {
    dump($event->ticket->title);
});

// or
Event::listen(TicketCreated::class, [SomeListener::class, 'handle']);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Renato Nabinger](https://github.com/renatoxm)
- Forked from [ousid](https://github.com/ousid)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT. Please see the [license file](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Recently: every ~50 days

Total

15

Last Release

763d ago

Major Versions

v0.0.6 → v1.0.02023-09-20

v1.0.6 → v2.0.02024-04-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f82c3619c40d226620c909be4c3df2d60aad600781fe0edee8ce24724b19fcd?d=identicon)[renatoxm](/maintainers/renatoxm)

---

Top Contributors

[![ousid](https://avatars.githubusercontent.com/u/21012933?v=4)](https://github.com/ousid "ousid (74 commits)")[![renatoxm](https://avatars.githubusercontent.com/u/6808753?v=4)](https://github.com/renatoxm "renatoxm (29 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (6 commits)")[![neazk](https://avatars.githubusercontent.com/u/28840712?v=4)](https://github.com/neazk "neazk (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![krekas](https://avatars.githubusercontent.com/u/11015977?v=4)](https://github.com/krekas "krekas (4 commits)")[![juliangarcess](https://avatars.githubusercontent.com/u/41131304?v=4)](https://github.com/juliangarcess "juliangarcess (1 commits)")[![ennikin-skywalker](https://avatars.githubusercontent.com/u/9866493?v=4)](https://github.com/ennikin-skywalker "ennikin-skywalker (1 commits)")[![JaberWiki](https://avatars.githubusercontent.com/u/55241455?v=4)](https://github.com/JaberWiki "JaberWiki (1 commits)")[![akiyamaSM](https://avatars.githubusercontent.com/u/12276076?v=4)](https://github.com/akiyamaSM "akiyamaSM (1 commits)")

---

Tags

laravellaravel-ticketRenatoxm

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/renatoxm-laravel-ticket/health.svg)

```
[![Health](https://phpackages.com/badges/renatoxm-laravel-ticket/health.svg)](https://phpackages.com/packages/renatoxm-laravel-ticket)
```

###  Alternatives

[guava/filament-knowledge-base

A filament plugin that adds a knowledge base and help to your filament panel(s).

206120.5k1](/packages/guava-filament-knowledge-base)[ralphjsmit/laravel-filament-seo

A package to combine the power of Laravel SEO and Filament Admin.

15398.7k10](/packages/ralphjsmit-laravel-filament-seo)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[geo-sot/filament-env-editor

Access .env file though Filament admin panel

2432.3k1](/packages/geo-sot-filament-env-editor)[caresome/filament-neobrutalism-theme

A neobrutalism theme for FilamentPHP admin panels

303.2k](/packages/caresome-filament-neobrutalism-theme)[andreia/filament-ui-switcher

Add a modal with options to switch between different UI layouts and styles (colors, fonts, font sizes).

233.8k](/packages/andreia-filament-ui-switcher)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
