I am trying to make Laravel package which will send an email.
There is my folder structure after publish package
http://prntscr.com/nbddef
As you see I have template there
But when I try to send a mail I receive this exception:
#message: "View [D:\OSPanel\domains\testPackage.loc\app.Widgets.views.template] not found."
I was trying to change this template path in my code but it doesnt help
<?php
namespace Imediasun\Widgets\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Contracts\Mail\Mailer as MailerContract;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class OrderSend extends Mailable
{
use Queueable, SerializesModels;
protected $order;
public function __construct()
{
$this->sub='New Csv Import Received';
$this->recipient='imediasun@gmail.com';
$this->sender=['address'=>'imediasu1n@gmail.com','name'=>'Andrey'];
$this->template=app_path() .'/Widgets/views/template';
$this->exception=false;
}
public function build()
{
return $this->from($this->sender)->to($this->recipient)->subject($this->sub)->view($this->template);
}
}
这是您需要这样做的承包商
$this->template='Widgets::template';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.