App\Listeners\ActivityListener::updatedInvoice PHP Method

updatedInvoice() public method

public updatedInvoice ( InvoiceWasUpdated $event )
$event App\Events\InvoiceWasUpdated
    public function updatedInvoice(InvoiceWasUpdated $event)
    {
        if (!$event->invoice->isChanged()) {
            return;
        }
        $backupInvoice = Invoice::with('invoice_items', 'client.account', 'client.contacts')->withArchived()->find($event->invoice->id);
        $activity = $this->activityRepo->create($event->invoice, ACTIVITY_TYPE_UPDATE_INVOICE, $event->invoice->getAdjustment());
        $activity->json_backup = $backupInvoice->hidePrivateFields()->toJSON();
        $activity->save();
    }