Import notification file and updated other file..

This commit is contained in:
Cüneyt Şentürk
2021-06-19 22:30:14 +03:00
parent 4687185f4a
commit 5c5b890942
12 changed files with 182 additions and 27 deletions

View File

@@ -11,11 +11,18 @@ class ImportCompleted extends Notification implements ShouldQueue
{
use Queueable;
protected $translation;
protected $total_rows;
/**
* Create a notification instance.
*/
public function __construct()
public function __construct($translation, $total_rows)
{
$this->translation = $translation;
$this->total_rows = $total_rows;
$this->onQueue('notifications');
}
@@ -27,7 +34,7 @@ class ImportCompleted extends Notification implements ShouldQueue
*/
public function via($notifiable)
{
return ['mail'];
return ['mail', 'database'];
}
/**
@@ -45,4 +52,18 @@ class ImportCompleted extends Notification implements ShouldQueue
->line(trans('notifications.import.completed.description'))
->action(trans_choice('general.dashboards', 1), $dashboard_url);
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'translation' => $this->translation,
'total_rows' => $this->total_rows,
];
}
}

View File

@@ -38,7 +38,7 @@ class ImportFailed extends Notification implements ShouldQueue
*/
public function via($notifiable)
{
return ['mail'];
return ['mail', 'database'];
}
/**
@@ -50,8 +50,8 @@ class ImportFailed extends Notification implements ShouldQueue
public function toMail($notifiable)
{
$message = (new MailMessage)
->subject(trans('notifications.import.failed.subject'))
->line(trans('notifications.import.failed.description'));
->subject(trans('notifications.import.failed.subject'))
->line(trans('notifications.import.failed.description'));
foreach ($this->errors as $error) {
$message->line($error);
@@ -59,4 +59,17 @@ class ImportFailed extends Notification implements ShouldQueue
return $message;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'errors' => $this->errors,
];
}
}