Skip to content

Commit f6edd16

Browse files
committed
update README.md
1 parent a149237 commit f6edd16

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

README.md

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [Introduction](#introduction)
1212
- [Installation](#installation)
1313
- [Configuration](#configuration)
14+
- [Preparing your model](#preparing-your-model)
1415
- [Usage](#usage)
1516
- [Ticket Table Structure](#ticket-table-structure)
1617
- [Message Table Structure](#message-table-structure)
@@ -21,6 +22,7 @@
2122
- [Ticket Relationship API Methods](#ticket-relationship-api-methods)
2223
- [Ticket Scopes](#ticket-scopes)
2324
- [Category & Label Scopes](#category--label-scopes)
25+
- [Handling File Upload](#handling-file-upload)
2426
- [Testing](#testing)
2527
- [Changelog](#changelog)
2628
- [Contributing](#contributing)
@@ -58,6 +60,8 @@ Before Running the migration, you may publish the config file, and make sure the
5860
php artisan migrate
5961
```
6062

63+
## Preparing your model
64+
6165
Add `HasTickets` trait into your `User` model, along with `CanUseTickets` interface
6266

6367
```php
@@ -236,22 +240,48 @@ The `ticket` model has also a list of scopes to begin filter with.
236240

237241
| Method | Arguments | Description | Example |
238242
|---|---|---|---|
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()` |
248252

249253
### Category & Label Scopes
250254
| Method | Arguments | Description | Example |
251255
|---|---|---|---|
252256
| `visible` |`void` | get the visible model records | `Label::visible()->get()` |
253257
| `hidden` |`void` | get the hidden model records | `Category::visible()->get()` |
254258

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+
255285
## Testing
256286

257287
```bash

0 commit comments

Comments
 (0)