case FREQUENCY_MONTHLY: return $monthsSinceLastSent >= 1; case FREQUENCY_THREE_MONTHS: return $monthsSinceLastSent >= 3; case FREQUENCY_SIX_MONTHS: return $monthsSinceLastSent >= 6; case FREQUENCY_ANNUALLY: return $monthsSinceLastSent >= 12; default: return false; } return false; } } Invoice::creating(function ($invoice) { if (!$invoice->is_recurring) { $invoice->account->incrementCounter($invoice->is_quote); } }); Invoice::created(function ($invoice) { Activity::createInvoice($invoice); }); Invoice::updating(function ($invoice) { Activity::updateInvoice($invoice); }); Invoice::deleting(function ($invoice) { Activity::archiveInvoice($invoice); }); Invoice::restoring(function ($invoice) { Activity::restoreInvoice($invoice); });