|
11 | 11 | - [Introduction](#introduction)
|
12 | 12 | - [Installation](#installation)
|
13 | 13 | - [Configuration](#configuration)
|
| 14 | +- [Preparing your model](#preparing-your-model) |
14 | 15 | - [Usage](#usage)
|
15 | 16 | - [Ticket Table Structure](#ticket-table-structure)
|
16 | 17 | - [Message Table Structure](#message-table-structure)
|
|
21 | 22 | - [Ticket Relationship API Methods](#ticket-relationship-api-methods)
|
22 | 23 | - [Ticket Scopes](#ticket-scopes)
|
23 | 24 | - [Category & Label Scopes](#category--label-scopes)
|
| 25 | +- [Handling File Upload](#handling-file-upload) |
24 | 26 | - [Testing](#testing)
|
25 | 27 | - [Changelog](#changelog)
|
26 | 28 | - [Contributing](#contributing)
|
@@ -58,6 +60,8 @@ Before Running the migration, you may publish the config file, and make sure the
|
58 | 60 | php artisan migrate
|
59 | 61 | ```
|
60 | 62 |
|
| 63 | +## Preparing your model |
| 64 | + |
61 | 65 | Add `HasTickets` trait into your `User` model, along with `CanUseTickets` interface
|
62 | 66 |
|
63 | 67 | ```php
|
@@ -236,22 +240,48 @@ The `ticket` model has also a list of scopes to begin filter with.
|
236 | 240 |
|
237 | 241 | | Method | Arguments | Description | Example |
|
238 | 242 | |---|---|---|---|
|
239 |
| -| `closed` |`void` | get the closed tickets | `Ticket::closed()` | |
240 |
| -| `opened` |`void` | get the opened tickets | `Ticket::opened()` | |
241 |
| -| `resolved` |`void` | get the resolved tickets | `Ticket::resolved()` | |
242 |
| -| `locked` |`void` | get the locked tickets | `Ticket::locked()` | |
243 |
| -| `unlocked` |`void` | get the unlocked tickets | `Ticket::unlocked()` | |
244 |
| -| `withLowPriority` |`void` | get the low priority tickets | `Ticket::withLowPriority()` | |
245 |
| -| `withNormalPriority` |`void` | get the normal priority tickets | `Ticket::withNormalPriority()` | |
246 |
| -| `withHighPriority` |`void` | get the high priority tickets | `Ticket::withHighPriority()` | |
247 |
| -| `withPriority` |`string` $priority | get the withPriority tickets | `Ticket::withPriority('critical')` | |
| 243 | +| `closed` |`void` | get the closed tickets | `Ticket::closed()->get()` | |
| 244 | +| `opened` |`void` | get the opened tickets | `Ticket::opened()->get()` | |
| 245 | +| `resolved` |`void` | get the resolved tickets | `Ticket::resolved()->get()` | |
| 246 | +| `locked` |`void` | get the locked tickets | `Ticket::locked()->get()` | |
| 247 | +| `unlocked` |`void` | get the unlocked tickets | `Ticket::unlocked()->get()` | |
| 248 | +| `withLowPriority` |`void` | get the low priority tickets | `Ticket::withLowPriority()->get()` | |
| 249 | +| `withNormalPriority` |`void` | get the normal priority tickets | `Ticket::withNormalPriority()->get()` | |
| 250 | +| `withHighPriority` |`void` | get the high priority tickets | `Ticket::withHighPriority()->get()` | |
| 251 | +| `withPriority` |`string` $priority | get the withPriority tickets | `Ticket::withPriority('critical')->get()` | |
248 | 252 |
|
249 | 253 | ### Category & Label Scopes
|
250 | 254 | | Method | Arguments | Description | Example |
|
251 | 255 | |---|---|---|---|
|
252 | 256 | | `visible` |`void` | get the visible model records | `Label::visible()->get()` |
|
253 | 257 | | `hidden` |`void` | get the hidden model records | `Category::visible()->get()` |
|
254 | 258 |
|
| 259 | +## Handling File Upload |
| 260 | +This package doesn't came with file upload feature (yet) Instead you can use [laravel-medialibrary](https://github.com/spatie/laravel-medialibrary) by __Spatie__, |
| 261 | +to handle function file functionality. |
| 262 | + |
| 263 | +The steps is pretty straight forward, all what you need to do is the following. |
| 264 | + |
| 265 | +Extends the `Ticket` model, by creating a new model file in your application by |
| 266 | +``` |
| 267 | +php artisan make:model Ticket |
| 268 | +``` |
| 269 | + |
| 270 | +Then extend the base `Ticket Model`, then use `InteractWithMedia` trait by spatie package, and the interface `HasMedia`: |
| 271 | + |
| 272 | +```php |
| 273 | +namespace App\Models\Ticket; |
| 274 | +use Spatie\MediaLibrary\HasMedia; |
| 275 | +use Spatie\MediaLibrary\InteractsWithMedia; |
| 276 | + |
| 277 | +class Ticket extends \Coderflex\LaravelTicket\Models\Ticket implements HasMedia |
| 278 | +{ |
| 279 | + use InteractsWithMedia; |
| 280 | +} |
| 281 | +``` |
| 282 | + |
| 283 | +The rest of the implementation, head to [the docs](https://spatie.be/docs/laravel-medialibrary/v10/introduction) of spatie package to know more. |
| 284 | + |
255 | 285 | ## Testing
|
256 | 286 |
|
257 | 287 | ```bash
|
|
0 commit comments