akaunting 3.0 (the last dance)
This commit is contained in:
@ -3,31 +3,31 @@
|
||||
namespace App\Notifications\Purchase;
|
||||
|
||||
use App\Abstracts\Notification;
|
||||
use App\Models\Common\EmailTemplate;
|
||||
use App\Models\Setting\EmailTemplate;
|
||||
use App\Models\Document\Document;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Bill extends Notification
|
||||
{
|
||||
/**
|
||||
* The bill model.
|
||||
*
|
||||
* @var object
|
||||
* @var Document
|
||||
*/
|
||||
public $bill;
|
||||
|
||||
/**
|
||||
* The email template.
|
||||
*
|
||||
* @var \App\Models\Common\EmailTemplate
|
||||
* @var EmailTemplate
|
||||
*/
|
||||
public $template;
|
||||
|
||||
/**
|
||||
* Create a notification instance.
|
||||
*
|
||||
* @param object $bill
|
||||
* @param object $template_alias
|
||||
*/
|
||||
public function __construct($bill = null, $template_alias = null)
|
||||
public function __construct(Document $bill = null, string $template_alias = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@ -39,11 +39,10 @@ class Bill extends Notification
|
||||
* Build the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
public function toMail($notifiable): MailMessage
|
||||
{
|
||||
$message = $this->initMessage();
|
||||
$message = $this->initMailMessage();
|
||||
|
||||
return $message;
|
||||
}
|
||||
@ -52,12 +51,13 @@ class Bill extends Notification
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
public function toArray($notifiable): array
|
||||
{
|
||||
return [
|
||||
'template_alias' => $this->template->alias,
|
||||
'title' => trans('notifications.menu.' . $this->template->alias . '.title'),
|
||||
'description' => trans('notifications.menu.' . $this->template->alias . '.description', $this->getTagsBinding()),
|
||||
'bill_id' => $this->bill->id,
|
||||
'bill_number' => $this->bill->document_number,
|
||||
'vendor_name' => $this->bill->contact_name,
|
||||
@ -68,7 +68,7 @@ class Bill extends Notification
|
||||
];
|
||||
}
|
||||
|
||||
public function getTags()
|
||||
public function getTags(): array
|
||||
{
|
||||
return [
|
||||
'{bill_number}',
|
||||
@ -86,7 +86,7 @@ class Bill extends Notification
|
||||
];
|
||||
}
|
||||
|
||||
public function getTagsReplacement()
|
||||
public function getTagsReplacement(): array
|
||||
{
|
||||
return [
|
||||
$this->bill->document_number,
|
||||
|
Reference in New Issue
Block a user