title: Laravel send email, error: Argument 2 passed to
body: <p>I have a problem with send email with Laravel, it's my method:</p>
  
  <pre><code>public function store(CreateUserRequest $request){
      $name = Input::get('name');
      $imie = Input::get('imie');
      $nazwisko = Input::get('nazwisko');
      $email = array('email' =&gt; Input::get('email'));
      $password = Input::get('password');
  
      Mail::send(['name' =&gt; $name], function ($message) use ($name, $imie, $nazwisko, $email, $password) {
          $message-&gt;from('us@example.com', 'System Magazyn');
          $message-&gt;attach('Your temporary password: '.['password' =&gt; $password]);
          $message-&gt;to(['email'=&gt;$email])-&gt;subject('Rejestracja Magazyn');
  
      });
  
      User::create($request-&gt;all());
      Session::flash('addUserOK', 'Użytkownik dodany poprawnie.');
      return redirect('user');
  }
  </code></pre>
  
  <p>This method saved to database new user. I want send email to new user with information on the correct registration and information with temporary password.
  I did as it is written in the documentation <a href="https://laravel.com/docs/5.2/mail#sending-mail" rel="nofollow noreferrer">https://laravel.com/docs/5.2/mail#sending-mail</a> 
  and as it is in this topic: <a href="https://stackoverflow.com/questions/21565272/laravel-4-from-contact-form-to-admin-email">Laravel 4 from contact form to admin email</a>, but still Laravel returned error:</p>
  
  <blockquote>
    <p>FatalThrowableError in Mailer.php line 149: Type error: Argument 2
    passed to Illuminate\Mail\Mailer::send() must be of the type array,
    object given, called in
    C:\xampp\htdocs\kurwa_magazyn\magazyn_michal\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php
    on line 219</p>
  </blockquote>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This is form to register new user:</p>
  
  <pre><code>{!! Form::open(['route' =&gt; 'user.store', 'method' =&gt; 'post', 'class' =&gt; 'form-horizontal']) !!}
  
      {!! Form::text('name', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Nazwa użytkownika...']) !!}&lt;br /&gt;
      {!! Form::text('imie', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Imię...']) !!}&lt;br /&gt;
      {!! Form::text('nazwisko', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Nazwwisko...']) !!}&lt;br /&gt;
      {!! Form::email('email', null, ['class' =&gt; 'form-control', 'placeholder' =&gt; 'Adres e-mail...']) !!}&lt;br /&gt;
      {!! Form::text('password', uniqid(), array('class' =&gt; 'form-control', 'placeholder' =&gt; 'Podaj hasło...')) !!}&lt;br /&gt;
  
      {!! Form::select('permissions', array('0' =&gt; 'Pracownik fizyczny', '2' =&gt; 'Magazynier', '3' =&gt; 'Demo użytkownik', '1' =&gt; 'Administrator'), NULL, ['class' =&gt; 'form-control']) !!}&lt;br /&gt;
      {!! Form::hidden('remember_token', bcrypt(uniqid(rand(0,9)))) !!}
  
      {!! Form::submit('Dodaj', ['class' =&gt; 'btn btn-default']); !!}
  {!! Form::close() !!}
  </code></pre>