You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before Running the migration, you may publish the config file, and make sure the current tables does not make a confilict with your existing application, and once you are happy with the migration table, you can run
54
+
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
37
55
38
56
```bash
39
57
php artisan migrate
40
58
```
41
59
60
+
Add `HasTickets` trait into your `User` model, along with `CanUseTickets` interface
61
+
62
+
```php
63
+
...
64
+
use Coderflex\LaravelTicket\Concerns\HasTickets;
65
+
use Coderflex\LaravelTicket\Contracts\CanUseTickets;
66
+
...
67
+
class User extends Model implements CanUseTickets
68
+
{
69
+
...
70
+
use HasTickets;
71
+
...
72
+
}
73
+
```
74
+
42
75
## Usage
43
76
44
77
The Basic Usage of this package, is to create a `ticket`, then associate the `labels` and the `categories` to it.
@@ -74,14 +107,39 @@ public function store(Request $request)
@@ -146,7 +204,7 @@ The `ticket` model came with a handy methods to use, to make your building proce
146
204
| `isOpen` |`void` | check if the ticket open | `$ticket->isOpen()` | ✗
147
205
| `isClosed` |`void` | check if the ticket closed | `$ticket->isClosed()` | ✗
148
206
| `isResolved` |`void` | check if the ticket has a resolved status | `$ticket->isResolved()` | ✗
149
-
| `isUnresolved` |`void` | check if the ticket has a unresolved status | `$ticket->isUnresolved()` | ✗
207
+
| `isUnresolved` |`void` | check if the ticket has an unresolved status | `$ticket->isUnresolved()` | ✗
150
208
| `isLocked` |`void` | check if the ticket is locked | `$ticket->isLocked()` | ✗
151
209
| `isUnlocked` |`void` | check if the ticket is unlocked | `$ticket->isUnlocked()` | ✗
152
210
@@ -156,22 +214,28 @@ The __Chainable__ column, is showing the state for the method, that if it can be
156
214
->close()
157
215
->markAsResolved();
158
216
```
159
-
## Ticket Relashionship API Methods
217
+
###Ticket Relationship API Methods
160
218
The `ticket` model has also a list of methods for interacting with another related models
161
219
162
220
| Method | Arguments | Description | Example |
163
221
|---|---|---|---|
164
-
|`attachLabels`|`mixed`id, `array` attributes, `bool` touch | associate labels into an existing ticket |`$ticket->attachLabels([1,2,3,4])`|
165
-
|`syncLabels`|`Model/array`ids, `bool` detouching | associate labels into an existing ticket |`$ticket->syncLabels([1,2,3,4])`|
166
-
|`attachCategories`|`mixed`id, `array` attributes, `bool` touch | associate categories into an existing ticket |`$ticket->attachCategories([1,2,3,4])`|
167
-
|`syncCategories`|`Model/array`ids, `bool` detouching | associate categories into an existing ticket |`$ticket->syncCategories([1,2,3,4])`|
222
+
|`attachLabels`|`mixed`ID, `array` attributes, `bool` touch | associate labels into an existing ticket |`$ticket->attachLabels([1,2,3,4])`|
223
+
|`syncLabels`|`Model/array`IDs, `bool` detouching | associate labels into an existing ticket |`$ticket->syncLabels([1,2,3,4])`|
224
+
|`attachCategories`|`mixed`ID, `array` attributes, `bool` touch | associate categories into an existing ticket |`$ticket->attachCategories([1,2,3,4])`|
225
+
|`syncCategories`|`Model/array`IDs, `bool` detouching | associate categories into an existing ticket |`$ticket->syncCategories([1,2,3,4])`|
168
226
|`message`|`string` message | add new message on an existing ticket |`$ticket->message('A message in a ticket')`|
169
-
|`messageAsUser`|`Model/null` user, `string` message | add new message on an existing ticket as a deffrent user |`$ticket->messageAsUser($user, 'A message in a ticket')`|
227
+
|`messageAsUser`|`Model/null` user, `string` message | add new message on an existing ticket as a different user |`$ticket->messageAsUser($user, 'A message in a ticket')`|
170
228
171
229
> 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)
172
230
173
231
The `commentAsUser` accepts a user as a first argument, if it's null, the __authenticated__ user will be user as default.
174
232
233
+
### Category & Label Scopes
234
+
| Method | Arguments | Description | Example |
235
+
|---|---|---|---|
236
+
|`visible`|`void`| get the visible model records |`Label::visible()->get()`|
237
+
|`hidden`|`void`| get the hidden model records |`Category::visible()->get()`|
0 commit comments