saasplayground/support-tickets
Composer 安装命令:
composer require saasplayground/support-tickets
包简介
Support tickets for your laravel app
README 文档
README
Support Tickets package with API first approach. It provides a simple and easy API to add support tickets to your Laravel app. Supports Laravel 8 and above.
Installation
You can install the package via composer:
composer require saasplayground/support-tickets
Then publish config file:
php artisan vendor:publish --tag=support-tickets-config
Finally run the migrate command:
php artisan migrate
Usage
User Setup and API
To enable users to open tickets, add InteractsWithTickets trait to your User model.
use InteractsWithTickets;
InteractsWithTickets Methods
openTicket: Open a new support ticket.postMessageOnTicket: Post a new message on an existing ticket.tickets: Gets tickets owned by user. Query builder methods can be chained on it.
openTicket Method: Ticket
Returns an instance of
Ticketmodel.
Expects the following parameters:
data: An array containing title, message, priority, sourcerelations: (Optional) An array of relationships; Support for addinglabels,categories
postMessageOnTicket Method: Ticket
Returns an instance of
Ticketmodel.
Expects following parameters:
ticket: The ticket modelmessage: The message to be posteduser: (Optional) Theidormodelof user that will be attached to message
Tickets Setup and API
By default the Ticket model does not need any setup, but if you are extending it, be sure
to update the corresponding value under models in config file.
Ticket Model Methods
syncCategories: Handles adding and deleting of entity categories.addCategories: Add categories to the entity.detachCategories: Removes given categories from entity.categories: The categories that belong to the model. Query builder methods can be chained on it.syncLabels: Handles adding and deleting of entity labels.addLabels: Add labels to the entity.detachLabels: Removes given labels from entity.labels: The labels that belong to the model. Query builder methods can be chained on it.addMessage: Add message to the entity.detachMessages: Removes a set of messages or all messages from entity.messages: The messages that belong to the model. Query builder methods can be chained on it.postMessageAsAgent: Posts a message as agent.assignAgent: Assigns an agent to the ticket.
syncCategories: void
Expects the following parameters:
categories: An array of ids, int, or collection (model instances)
addCategories: void
Expects the following parameters:
categories: An array of ids, int, or collection (model instances)
detachCategories: void
Expects the following parameters:
categories: An array of ids, int, or collection (model instances)
categories: Collection
Returns a collection of or query builder instance of
Categorymodel.
syncLabels: void
Expects the following parameters:
labels: An array of ids, int, or collection (model instances)
addLabels: void
Expects the following parameters:
labels: An array of ids, int, or collection (model instances)
detachLabels: void
Expects the following parameters:
labels: An array of ids, int, or collection (model instances)
labels: Collection
Returns a collection of or query builder instance of
Labelmodel.
addMessage: false or Message
Returns false if user cannot be resolved or message cannot be created, else an instance of Message Model
Expects the following parameters:
body: Astringcontaining the messageuser: (Optional) A userid,Modelornull(when null default value is the ticket's user id)
detachMessages: void
Expects the following parameters:
messages: (Optional) An array of ids, model id, or collection (model instances);
Deletes all messages when no value passed.
messages: Collection
Returns a collection of or query builder instance of
Messagemodel.
postMessageAsAgent: false or Message
Returns false if user cannot be resolved or message cannot be created, else an instance of Message Model
Expects the following parameters:
message: Astringcontaining the message body
assignAgent: false or Ticket
Returns false if user cannot be resolved, else an instance of
Ticketmodel to chain more operations.
Expects the following parameters:
value:intorUsermodel instance.
Configuration
See the published support-tickets config file for available options.
Note: When modifying the config file, ensure the users, tables and models values are always set.
Most of the default setup is set to match the basic Laravel app structure, hence there is no need to modify the config file heavily.
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email miracuthbert@gmail.com instead of using the issue tracker.
Credits
License
The GNU GPLv3. Please see License File for more information.
saasplayground/support-tickets 适用场景与选型建议
saasplayground/support-tickets 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 667 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「saasplayground」 「support-tickets」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 saasplayground/support-tickets 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 saasplayground/support-tickets 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 saasplayground/support-tickets 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 667
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2023-02-27