Laravel 发送邮件时出现未加括号的表达式错误
Laravel when sending mail giving unparenthesized expressions error
我正在尝试发送邮件,但出现以下错误:
The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence
以下是我在控制器中的代码
Employee::
where("organization_id", $billing->organization_id)
->permission([ Permission::BILLINGS_FULL_ACCESS ])
->withAllOrganizations()
->get()
->map(function($employee) use($billing) {
Mail::to($employee->work_email)->send(new BillingMail($billing));
});
这是我的邮件代码:
class BillingMail extends Mailable
{
使用 Queueable、SerializesModels;
protected $billing;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($billing)
{
$this->billing = $billing->load("organizations", "purchases");
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$pdf = new BillingPDF();
$pdf->AddSlip($this->billing);
$pdfName = "Invoice-" . $this->billing->id + 20220301;
$email = $this->subject("Tankhwa billing")
->view('emails.billing')
->attachData($pdf->Output('S', $pdfName), $pdfName, [
'mime' => 'application/pdf'
])
->with([
"billing" => $this->billing
]);
return $email;
}
我的其他邮件正在发送,它们使用了相同的逻辑,但是这封邮件出错了,请有人帮忙。
问题很可能是在这一行遇到的
$pdfName = "Invoice-" . $this->billing->id + 20220301;
尝试将其更改为
$value = $this->billing->id + 20220301;
$pdfName = "Invoice-" . $value;
更多信息:The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence
我正在尝试发送邮件,但出现以下错误:
The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence
以下是我在控制器中的代码
Employee::
where("organization_id", $billing->organization_id)
->permission([ Permission::BILLINGS_FULL_ACCESS ])
->withAllOrganizations()
->get()
->map(function($employee) use($billing) {
Mail::to($employee->work_email)->send(new BillingMail($billing));
});
这是我的邮件代码:
class BillingMail extends Mailable
{ 使用 Queueable、SerializesModels;
protected $billing;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($billing)
{
$this->billing = $billing->load("organizations", "purchases");
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$pdf = new BillingPDF();
$pdf->AddSlip($this->billing);
$pdfName = "Invoice-" . $this->billing->id + 20220301;
$email = $this->subject("Tankhwa billing")
->view('emails.billing')
->attachData($pdf->Output('S', $pdfName), $pdfName, [
'mime' => 'application/pdf'
])
->with([
"billing" => $this->billing
]);
return $email;
}
我的其他邮件正在发送,它们使用了相同的逻辑,但是这封邮件出错了,请有人帮忙。
问题很可能是在这一行遇到的
$pdfName = "Invoice-" . $this->billing->id + 20220301;
尝试将其更改为
$value = $this->billing->id + 20220301;
$pdfName = "Invoice-" . $value;
更多信息:The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence