Refactor Expected Checkin Notification into markdown and enable translation (#8236)

Co-authored-by: snipe <snipe@snipe.net>
This commit is contained in:
Dampfklon
2020-11-13 00:09:40 +01:00
committed by GitHub
parent 1f9b04405c
commit be114176a2
3 changed files with 36 additions and 11 deletions
@@ -2,7 +2,7 @@
namespace App\Notifications;
use Carbon\Carbon;
use App\Helpers\Helper;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
@@ -46,16 +46,18 @@ class ExpectedCheckinNotification extends Notification
*/
public function toMail()
{
$formatted_due = Carbon::parse($this->params->expected_checkin)->format('D, M j, Y');
return (new MailMessage)
->error()
->subject('Reminder: '.$this->params->present()->name().' checkin deadline approaching')
->line('Hi, '.$this->params->assignedto->first_name.' '.$this->params->assignedto->last_name)
->greeting('An asset checked out to you is due to be checked back in on '.$formatted_due.'.')
->line('Asset: '.$this->params->present()->name())
->line('Serial: '.$this->params->serial)
->line('Asset Tag: '.$this->params->asset_tag)
->action('View Your Assets', route('view-assets'));
$message = (new MailMessage)->markdown('notifications.markdown.expected-checkin',
[
'date' => Helper::getFormattedDateObject($this->params->expected_checkin, 'date', false),
'asset' => $this->params->present()->name(),
'serial' => $this->params->serial,
'asset_tag' => $this->params->asset_tag
])
->subject(trans('mail.Expected_Checkin_Notification', ['name' => $this->params->present()->name()]));
return $message;
}
}