Add Notification class to DocumentReminded event

This commit is contained in:
Burak Çakırel
2021-04-20 23:23:30 +03:00
parent 62d5442578
commit 96f9a99077
3 changed files with 15 additions and 12 deletions

View File

@ -10,6 +10,7 @@ use App\Models\Banking\Transaction;
use App\Models\Common\Company;
use App\Models\Common\Recurring;
use App\Models\Document\Document;
use App\Notifications\Sale\Invoice as Notification;
use App\Utilities\Date;
use Illuminate\Console\Command;
@ -122,6 +123,7 @@ class RecurringCheck extends Command
protected function recur($model, $type, $schedule_date)
{
\DB::transaction(function () use ($model, $type, $schedule_date) {
/** @var Document $clone */
if (!$clone = $this->getClone($model, $schedule_date)) {
return;
}
@ -130,7 +132,9 @@ class RecurringCheck extends Command
case 'App\Models\Document\Document':
event(new DocumentCreated($clone, request()));
event(new DocumentRecurring($clone));
if ($clone->type === Document::INVOICE_TYPE) {
event(new DocumentRecurring($clone, Notification::class));
}
break;
case 'App\Models\Banking\Transaction':