dt3358 2015-04-30 21:49
浏览 53
已采纳

在对mandril的api-call中使用laravel-view

Ok, so I'm setting up a call to send an email using the mandrill-wrapper from packagist (rather than the build in mandrill-driver) since I want to use merge-vars.

So I set up my view and filled it. It renders correctly, all variables are set up and all is good (I test this by returning the view and see it's good).

next I set up $message, merge_vars- and to-array to send to my mandrill-object.

For $message["html"] I simply put

$message = array(
        'html' => View::make(
             'emails.wishlist.share',
             array(
               'name'=>Auth::user()->fName, 
               'list'=>$list));
...
);

if I just return the view, I can see it renders correctly, but when I actually make the api-call, I can see in the api-log, that the html-field is empty.

Is this because View::make() actually returns an object? And how to I get the raw html in that case?

  • 写回答

1条回答 默认 最新

  • dtwr2012 2015-04-30 21:50
    关注

    View::make() and view() return a view object. Call render to get the raw HTML string:

    $message = [
        'html' => view('emails.wishlist.share', [
            'name' => auth()->user()->fName, 
            'list' => $list,
        ])->render(),
    ];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题