title: Laravel 5 -> pass second argument to Mail::send method
body: <p>I want to modify the create method in my AuthController. A mail with a verification link should be send to the users email after he send the registration form. It's almost done, but I have a problem, passing the users details into the function.</p>
  
  <p>Here is what I have right now:</p>
  
  <pre><code>Mail::send('mails.registrierung', $data, function($message){
      $message-&gt;from('registrierung@junperbo.de', 'Registrierung');
      $message-&gt;to('email@yxz.de');
  });
  </code></pre>
  
  <p>But it's clear, that a hardcoded email is not working. So I want to pass the created user to the function. I tried to <code>global $user</code> within the function (no success). I also tried to pass a second argument  like: </p>
  
  <pre><code>Mail::send('mails.registrierung', $data, function($message, $user) {
      $message-&gt;from('registrierung@junperbo.de', 'Registrierung');
      $message-&gt;to($user-&gt;email);
  });
  </code></pre>
  
  <p>The result is this error message (for the line Mail::send(....)):</p>
  
  <blockquote>
    <p>Missing argument 2 for
    App\Http\Controllers\Auth\AuthController::App\Http\Controllers\Auth{closure}()</p>
  </blockquote>
  
  <p>My whole create method:</p>
  
  <pre><code>protected function create(array $data)
  {
      $user = User::create([
          'benutzername' =&gt; $data['benutzername'],
          'email' =&gt; $data['email'],
          'password' =&gt; bcrypt($data['password']),
          'bestaetigt' =&gt; 0,
          'verfikations_schluessel' =&gt; str_random(60)
      ]);
  
      $data['user'] = $user;
  
      Mail::send('mails.registrierung', $data, function($message, $user){
          $message-&gt;from('registrierung@junperbo.de', 'Registrierung');
          $message-&gt;to($user-&gt;email);
      });
  
      return $user;
  }
  </code></pre>
  
  <p>Any idea? Thanks!</p>