Add Notification class to DocumentReminded event

This commit is contained in:
Burak Çakırel
2020-12-25 22:30:59 +03:00
parent 2d023873cc
commit ec7511a8bc
6 changed files with 22 additions and 11 deletions

View File

@@ -3,9 +3,6 @@
namespace App\Listeners\Document;
use App\Events\Document\DocumentReminded as Event;
use App\Models\Document\Document;
use App\Notifications\Sale\Invoice as InvoiceNotification;
use App\Notifications\Purchase\Bill as BillNotification;
class SendDocumentReminderNotification
{
@@ -18,11 +15,7 @@ class SendDocumentReminderNotification
public function handle(Event $event)
{
$document = $event->document;
$notification = InvoiceNotification::class;
if ($document->type === Document::BILL_TYPE) {
$notification = BillNotification::class;
}
$notification = $event->notification;
// Notify the customer
if ($document->contact && !empty($document->contact_email)) {