【发布时间】:2019-04-13 18:48:38
【问题描述】:
我正在尝试制作将发送电子邮件的 Laravel 包。
发布包后有我的文件夹结构
http://prntscr.com/nbddef
如您所见,我在那里有模板
但是当我尝试发送邮件时,我收到了这个异常:
#message: "View [D:\OSPanel\domains\testPackage.loc\app.Widgets.views.template] not found."
我试图在我的代码中更改此模板路径,但没有帮助
<?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);
}
}
【问题讨论】:
-
试试这个 app_path('Widgets/views/template');
-
相同的结果抱歉查看 [D:\OSPanel\domains\testPackage.loc\app\Widgets.views.template] 未找到。