Reputation: 846
I have a send mail function in CommonHelper like
public static function send_plain_email($data){
$contact_email = CommonHelper::$admin_info['contact_email'];
$data['subject']= 'contact us';
Mail::send('emails.'.'plain_email', $data, function($message) use ($data , $contact_email) {
$message->from($data['email']);
$message->subject($data['subject']);
$message->to($contact_email);
if(!empty($attachment)){
$message->attach($attachment);
}
});
}
The data array is coming in this function but Mail::send function giving the following error
{
"success": false,
"message": "Undefined variable: data"
}
Which part of the code i am missing here ? any ideas ?
Upvotes: 1
Views: 243
Reputation: 23
check if your blade file have the blade naming extension at the back as follow: file_name.blade.php
Before that i forgot add .blade file extension behind the file name which show as file_name.php it could not detect any variable been sent to the blade.
To display specific data use the following format: {{ $merchant->name }}
Hope this help.
Upvotes: 1