This package manages Quantic Telecom's support regardless models., (*1)
Installation
You can install Quantic Telecom Support through composer:, (*2)
"require": {
"quantic-telecom/support": "~1.0"
}
Next, update app/config/app.php to include a reference to this package's service provider in the providers array., (*3)
'providers' => [
'QuanticTelecom\Support\SupportServiceProvider'
]
Controllers
Quantic Telecom support provides two controllers: QuanticTelecom\Support\Controllers\TicketsController and QuanticTelecom\Support\Controllers\CommentsController with some CRUD's methods., (*4)
-
TicketsController, (*5)
-
@create: show create form
-
@store: open a ticket
-
CommentsController, (*6)
-
@store: write a new comment
Routes
You may want to add your own routes for example in app/routes.php or in a service provider., (*7)
Contracts
Quantic Telecom support provides some contracts to implement., (*8)
Models
-
Ticket & Comment: meaningless doc blocs contracts;
Factories
Factories contracts provides a clean way to create models. Concrete implementations need to know how to create a new model instance and how to attach (for comments) a model to another., (*9)
-
OpenTicket: act like a ticket factory;
-
WriteComment: same as OpenTicket for comments.
Repositories
Quantic Telecom support needs repositories to manage database connection:
* TicketRepository: get and save tickets;
* CommentRepository: save a comment., (*10)
Commands
Laravel Commander (https://github.com/laracasts/Commander) provides an easy way to leverage commands and domain events. This package has two commands (and two handlers):
* OpenTicketCommand & OpenTicketCommandHandler: use OpenTicket factory to create a new ticket and TicketRepository to save this ticket;
* WriteCommentCommand & WriteCommentCommandHandler: use WriteComment factory to create and attach a new comment to a ticket and then CommentRepository to save / persist it., (*11)
Usage
See an usage example here: https://github.com/QuanticTelecom/moloquent-support, (*12)
Models
First, you need to create your models and implement Ticket and Comment contracts., (*13)
Repositories
Then, you need to create the repositories to implement both TicketRepository and CommentRepository., (*14)
Make sure to bind the interfaces to the concrete class(es) in a service provider for example., (*15)
Factories
Finally, you must build concrete classes for OpenTicket and WriteComment. Just follow the interfaces methods., (*16)