Feb 27, 2017
0
Level 5
How to use notification template on command handle?
I have a command to send emails to users every week. on the command->handle() I can use
$user = User::find($this->argument('user'));
Mail::to($user)->send(new PurchaseMail);
However, I would like to use the template of MailMessage which is meant to be use for notification like so.
return (new MailMessage)
->subject(app_name() . ': ' . trans('exceptions.frontend.auth.confirmation.confirm'))
->line(trans('strings.emails.auth.click_to_confirm'))
->action(trans('buttons.emails.auth.confirm_account'), route('frontend.auth.account.confirm', $this->confirmation_code))
->line(trans('strings.emails.auth.thank_you_for_using_app'));
Can I return a MailMessage in handle method? If not, could you tell me how I can use it in handle method like I'm using
Mail::to($user)->send(new PurchaseMail);
thanks
Please or to participate in this conversation.