I am wondering here by the parameter passing in the new Laravel Mail class. My IDE (VSCode) also underlines the parameter and throws the following error: syntax error, unexpected ':', expecting ')'
public function envelope()
{
return new Envelope(
subject: 'Subject', // <-- the key subject
from: 'test@test.fr', // <-- the key from
);
}
Nevertheless, it works. It's probably a new PHP specification that I don't know yet. What is it called and does it work? And how can I teach my IDE that it is not an error?
you can write code in this syntax
public function envelope()
{
return $this->view('mail.welcome') // <-- View File Name
->from('test@test.fr')
->subject('Subject')
}
Hello Friend Your Syntax Is Wrong The Syntax in Laravel 9.0.0 in image
enter image description here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.