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

@@ -3,7 +3,6 @@
namespace App\Listeners\Document;
use App\Events\Document\DocumentRecurring as Event;
use App\Notifications\Sale\Invoice as Notification;
class SendDocumentRecurringNotification
{
@@ -16,10 +15,11 @@ class SendDocumentRecurringNotification
public function handle(Event $event)
{
$document = $event->document;
$notification = $event->notification;
// Notify the customer
if ($document->contact && !empty($document->contact_email)) {
$document->contact->notify(new Notification($document, "{$document->type}_recur_customer"));
$document->contact->notify(new $notification($document, "{$document->type}_recur_customer"));
}
// Notify all users assigned to this company
@@ -28,7 +28,7 @@ class SendDocumentRecurringNotification
continue;
}
$user->notify(new Notification($document, "{$document->type}_recur_admin"));
$user->notify(new $notification($document, "{$document->type}_recur_admin"));
}
}
}