Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two arguments to closure function laravel

Tags:

php

laravel

I have a email send function:

   Mail::send('emails.message', ['text'=> $email['message']], function($message, $email)
    {
        $message->to($email['email'], 'Name')->subject('Subj'); 
    }); 

And now i have a error: Missing argument 2 for {closure}() How i can flash $email to the my closure function?

like image 926
engilexial Avatar asked Dec 14 '25 08:12

engilexial


1 Answers

Try this:

function ($message) use ($email) {
   //...
}
like image 74
Waldson Patricio Avatar answered Dec 15 '25 21:12

Waldson Patricio