File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 44namespace RexlManu \LaravelTickets \Observers ;
55
66
7+ use Ramsey \Uuid \Uuid ;
78use RexlManu \LaravelTickets \Events \TicketCloseEvent ;
89use RexlManu \LaravelTickets \Events \TicketOpenEvent ;
910use RexlManu \LaravelTickets \Models \Ticket ;
@@ -44,4 +45,11 @@ public function deleting(Ticket $ticket)
4445 $ ticket ->messages ()->get ()->each (fn (TicketMessage $ ticketMessage ) => $ ticketMessage ->delete ());
4546 }
4647
48+ public function creating (Ticket $ ticket )
49+ {
50+ if (config ('laravel-tickets.model.uuid ' ) && empty ($ model ->id )) {
51+ $ ticket ->id = Uuid::uuid4 ();
52+ }
53+ }
54+
4755}
Original file line number Diff line number Diff line change 44namespace RexlManu \LaravelTickets \Traits ;
55
66
7- use Ramsey \Uuid \Uuid ;
8-
97trait HasConfigModel
108{
119
@@ -18,14 +16,4 @@ public function isIncrementing()
1816 {
1917 return config ('laravel-tickets.model.incrementing ' );
2018 }
21-
22- public static function bootHasUuid ()
23- {
24- static ::creating (function ($ model ) {
25- if (config ('laravel-tickets.model.uuid ' ) && empty ($ model ->id )) {
26- $ model ->id = Uuid::uuid4 ();
27- }
28- });
29- }
30-
3119}
You can’t perform that action at this time.
0 commit comments