Open cocoeyes02 opened 5 years ago
The documentation already mentions
Laravel automatically makes the $message variable available to all of your email templates
IMO, rather than doing this (which creates a breaking change for little benefit) the documentation could be updated to better explain that there are reserved words that cannot be used as view parameter variables.
I'll add sentense which explain that there are reserved words that cannot be used as view parameter variables.
Problem
In class extends Notification, I inserted array ['message' => 'hoge'] at view method's second param. Then I executed dd($message) in view blade file, but it’s not result I expected.
For example
hoge.blade.php
Expected
huga
Result
cause
when using Render method Illuminate\Mail\Mailer,
$data
includes "message" property andSimpleMessage
’s property. https://github.com/laravel/framework/blob/5eef06c7b6a21857a41c7eada53303a94b87edad/src/Illuminate/Mail/Mailer.php#L213 https://github.com/laravel/framework/blob/5eef06c7b6a21857a41c7eada53303a94b87edad/src/Illuminate/Notifications/Channels/MailChannel.php#L64In other words, We can’t insert those keys in array at view method’s second param.
In my opinion
I think it’s not intuitive. it shouldn’t know "message" and SimpleMessage’s property when render tamplate.