首页 > 解决方案 > Markdown 邮件和视图:缓存导致错误“/resources/views/vendor/mail/text”目录不存在

问题描述

view:cache当我在发送通知邮件后尝试时出现错误:

“资源/视图/供应商/邮件/文本”目录不存在。

哪个是正确的,因为它不存在但它不是必需的?

\App\Models\User::find($user_id)->notify(new \App\Notifications\InvoicePaid());
        
Artisan::call('view:cache');

用户模型具有 Notifiable trait。InvoicePaid 是通过“邮件”的标准通知。

跟踪这个进一步的 Markdown 类会为邮件添加一个命名空间,但为什么它需要 vendor/mail/text 目录?

public function render($view, array $data = [], $inliner = null)
{
    $this->view->flushFinderCache();

    $contents = $this->view->replaceNamespace(
        'mail', $this->htmlComponentPaths()
    )->make($view, $data)->render();

    if ($this->view->exists($customTheme = Str::start($this->theme, 'mail.'))) {
        $theme = $customTheme;
    } else {
        $theme = Str::contains($this->theme, '::')
            ? $this->theme
            : 'mail::themes.'.$this->theme;
    }

    return new HtmlString(($inliner ?: new CssToInlineStyles)->convert(
        $contents, $this->view->make($theme, $data)->render()
    ));
}

标签: phplaravel

解决方案


推荐阅读