title: Undefined variable inside Laravel view when using Mail
body: <p>While trying to send verification email using Laravel 5.2, I get an error:</p>
  
  <blockquote>
    <p>Undefined variable: confirmation_code (View:
    C:\xampp\htdocs\laravel\resources\views\email\verify.blade.php)</p>
  </blockquote>
  
  <p>My code looks like this:</p>
  
  <p><em>Controller.php:</em></p>
  
  <pre><code>     public function postSignup(Request $request){                                                                               
         $this-&gt;validate($request,[
         'email'=&gt;'required|unique:users|email',
         'name'=&gt;'required|max:50|min:3',
         'password'=&gt;'required|min:6',
         'con-password'=&gt;'required|same:password',
                 ]);
  
      $confirmation_code=['code'=&gt;str_random(20)];
      $name = $request-&gt;input('name');
  
      Mail::send('email.verify',$confirmation_code,function($message)
          use($request,$name){
          $message-&gt;to($request-&gt;input('email'),$name)
                  -&gt;subject('Verify Your Email Address');
      });
  
  
      User::create([
              'email'=&gt;$request-&gt;input('email'),
              'name'=&gt;$request-&gt;input('name'),                
              'password'=&gt;bcrypt($request-&gt;input('password'))                          
          ]);
  
      return redirect()-&gt;back()-&gt;with('info','Congratulation you have been successfully registered.Please check your email for verification');
      } 
  </code></pre>
  
  <p><em>Mail.verify.blade.php:</em></p>
  
  <pre><code>    &lt;h2&gt;Verify Your Email Address&lt;/h2&gt;
  
      &lt;div&gt;
          Thanks for creating an account with the verification demo app.
          Please follow the link below to verify your email address
          {{ URL::to('register/verify/'.$confirmation_code) }}.&lt;br/&gt;
  
      &lt;/div&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p></p>