【问题标题】:Call to a member function send() on string调用字符串上的成员函数 send()
【发布时间】:2019-04-17 18:27:59
【问题描述】:

我收到了对字符串成员函数 send() 的调用。我试图用这个标题阅读其他问题,但似乎都不是我的情况。

这就是我的函数的样子:

public function sendProjectTeam($clientId) {
   $clientEmail = Client::where('id', $clientId)->value('email');
   Mail::to($clientEmail->send(new ProjectRequestMail()));
   return redirect()->back();
}

【问题讨论】:

  • 问题是什么?
  • 当我在上述函数中使用send() 时,出现错误Call to a member function send() on string

标签: laravel sendmail member-functions


【解决方案1】:

您正在$clientEmail 字符串而不是Illuminate\Mail\PendingMail 实例上调用发送方法。

应该是:

Mail::to($clientEmail)->send(new ProjectRequestMail);
// ------------------^ The closing parenthesis 

【讨论】:

    猜你喜欢
    • 2016-05-10
    • 2018-08-26
    • 2016-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多