Payment send mail notification..

This commit is contained in:
Cüneyt Şentürk
2021-06-30 11:08:40 +03:00
parent 0fd2288116
commit 3ee49c5bd3
6 changed files with 70 additions and 3 deletions

View File

@ -0,0 +1,56 @@
<?php
namespace App\Listeners\Update\V21;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Models\Common\Company;
use App\Models\Common\EmailTemplate;
use Illuminate\Support\Facades\Artisan;
class Version21199 extends Listener
{
const ALIAS = 'core';
const VERSION = '2.1.19';
/**
* Handle the event.
*
* @param $event
*
* @return void
*/
public function handle(Event $event)
{
if ($this->skipThisUpdate($event)) {
return;
}
$this->updateEmailTemplate();
Artisan::call('cache:clear');
}
protected function updateEmailTemplate()
{
$company_id = company_id();
$companies = Company::cursor();
foreach ($companies as $company) {
$company->makeCurrent();
EmailTemplate::create([
'company_id' => $company->id,
'alias' => 'payment_new_vendor',
'class' => 'App\Notifications\Purchase\Payment',
'name' => 'settings.email.templates.payment_new_vendor',
'subject' => trans('email_templates.payment_new_vendor.subject'),
'body' => trans('email_templates.payment_new_vendor.body'),
]);
}
company($company_id)->makeCurrent();
}
}

View File

@ -79,7 +79,7 @@ class Payment extends Notification
return [
'template_alias' => $this->template->alias,
'payment_id' => $this->payment->id,
'customer_name' => $this->payment->contact->name,
'vendor_name' => $this->payment->contact->name,
'amount' => $this->payment->amount,
'payment_date' => company_date($this->payment->paid_at),
];
@ -91,7 +91,7 @@ class Payment extends Notification
'{payment_amount}',
'{payment_date}',
'{payment_admin_link}',
'{customer_name}',
'{vendor_name}',
'{company_name}',
'{company_email}',
'{company_tax_number}',

View File

@ -35,6 +35,7 @@ class Event extends Provider
'App\Listeners\Update\V21\Version2116',
'App\Listeners\Update\V21\Version2117',
'App\Listeners\Update\V21\Version2118',
'App\Listeners\Update\V21\Version2119',
],
'Illuminate\Auth\Events\Login' => [
'App\Listeners\Auth\Login',