title: Pass array parameter from controller to Mailable class. Laravel
body: <p>I am trying to send email after user successfully register. so right now i am stuck to pass data in email template.I am sending email with Mailable . so from my <strong>Register Controller</strong>  i using like that <code>Mail::to('example@email.com','User Name')-&gt;send(new Verify_Email())</code>
  So my question is how to pass array param into <code>new Verify_Email()</code>Massage build class.and so then how to pass from <strong>Verify_Email to View</strong>. </p>
  
  <p><strong>RegisterController.php</strong></p>
  
  <pre><code>public function __construct()
  {
      $this-&gt;middleware('guest');
  }
  
  /**
   * Get a validator for an incoming registration request.
   *
   * @param  array  $data
   * @return \Illuminate\Contracts\Validation\Validator
   */
  protected function validator(array $data)
  {
      return Validator::make($data, [
          'firstname' =&gt; 'required|max:255',
          'lastname' =&gt; 'required|max:255',
          'email' =&gt; 'required|email|max:255|unique:users',
          'password' =&gt; 'required|min:6|confirmed',
      ]);
  }
  
  /**
   * Create a new user instance after a valid registration.
   *
   * @param  array  $data
   * @return User
   */
  protected function create(array $data)
  {
      $confirmation_code = str_random(30);
      $user =  User::create([
          'firstname' =&gt; $data['firstname'],
          'lastname' =&gt; $data['lastname'],
          'email' =&gt; $data['email'],
          'password' =&gt; bcrypt($data['password']),
          'confirmation_code' =&gt; $confirmation_code
      ]);
      $email_data = ([
         'name' =&gt; $data['firstname'].' '.$data['lastname'],
          'link' =&gt; '#'
      ]);
      Mail::to('example@email.com','User Name')-&gt;send(new Verify_Email());
  
      return $user;
  
  }
  </code></pre>
  
  <p><strong>Verify_Email.php</strong></p>
  
  <pre><code>class Verify_Email extends Mailable
  {
   use Queueable, SerializesModels;
  
  /**
   * Create a new message instance.
   *
   * @return void
   */
  
  public function __construct()
  {
      //
  }
  
  /**
   * Build the message.
   *
   * @return $this
   */
  public function build()
  {
      return $this-&gt;from('example@example.com')
          -&gt;view('emails.verify-user');
          //--------------------------&gt; **Send data to view**
          //-&gt;with([            
              //'name' =&gt; $this-&gt;data-&gt;name,
              //'link' =&gt; $this-&gt;data-&gt;link
          //]); 
  }
  </code></pre>