Laravel:使用Mail:queue()将数据传递给视图

时间:2016-08-26 07:19:36

标签: php laravel email laravel-5.1

我将一些数据传递到电子邮件视图。但是当我执行Mail :: queue()时,当我用

检查时,它在终端中显示以下错误
php artisan queue:listen.

在终端显示以下错误

Argument 1 passed to Illuminate\Queue\Jobs\Job::resolveAndFire() must be of the type array, integer given, called in /home/aamir/project1/vendor/laravel/framework/src/Illuminate/Queue/Jobs/DatabaseJob.php on line 50 and defined

控制器代码

$feedbacklink = url() . '/survey/' . $randomstring;
$email_data = array(
                    'name' => "$getbuyername",
                    'email' => "$getbuyeremail",
                    'inspector' => "$inspectorname",
                    'files' => $list,
                    'link' => $feedbacklink,
                    'para1' => "$para1",
                    'address' => "$reportaddress"
                    );
Mail::queue('emails.frontendreportfeedback', $email_data, function($message) use ($email_data) {
           $message->from('abc@gmail.com', 'MyProject');
           $message->to($email_data['email'])->subject('Feedback Wanted for '.$email_data['address']);
         });

电子邮件视图

 <!DOCTYPE html>
 <html lang="en-US">
 <head>
    <meta charset="UTF-8">
    <title>Feedback Email</title>
</head>
<body style="font-family:Arial, Helvetica, sans-serif; font-size:16px;">

<p>{{ $para1 }}</p>

<p>Please provide your opinion via a very very short survey</p>
<p>{{ $link }}</p>
<p>Here are the list of files {{ $inspector }} uploaded.</p>
    @if(isset($files) && !empty($files))
    <ul>
        @foreach($files as $file)
            <li> <a href="{{ $file }}">{{  basename($file) }}</a>  </li>
        @endforeach
    </ul>
    @endif
Thank you

我是laravel的新手,非常感谢任何帮助。

0 个答案:

没有答案