Skip to content

Commit

Permalink
Removed unnecessary docs and replaced id with getKey in ticket reference
Browse files Browse the repository at this point in the history
  • Loading branch information
rexlManu committed Dec 13, 2020
1 parent d8b5e78 commit 4b4d4bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/Observers/TicketMessageObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ public function created(TicketMessage $ticketMessage)
$ticketActivity->save();

$ticket = $ticketMessage->ticket;
if ($ticketMessage->user_id != $ticket->user_id)

if ($ticketMessage->user_id != $ticket->user_id) {
$ticket->update([ 'state' => 'ANSWERED' ]);

}

event(new TicketMessageEvent($ticketMessage->ticket()->first(), $ticketMessage));
}

Expand Down
4 changes: 1 addition & 3 deletions src/Observers/TicketObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public function updated(Ticket $ticket)
if ($ticket->state == 'ANSWERED') {
return;
}
/**
* EDIT BY RENE, bin einfach krasser als Manu :O
*/

$ticketActivity = new TicketActivity([ 'type' => $ticket->state == 'OPEN' ? 'OPEN' : 'CLOSE' ]);
$ticketActivity->ticket()->associate($ticket);
$ticketActivity->targetable()->associate($ticket);
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasTicketReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait HasTicketReference
public function toReference() : string
{
$type = basename(get_class($this));
return "$type #$this->id";
return "$type #$this->getKey()";
}

}

0 comments on commit 4b4d4bd

Please sign in to comment.