title: How to insert data into MongoDB with Laravel
body: <p>First I've set the default by setting the database connection to be mongodb.</p>
  
  <pre><code>'mongodb' =&gt; [
        'driver'   =&gt; 'mongodb',
        'host'     =&gt; 'localhost',
        'username' =&gt; 'dofUser',
        'password' =&gt; 'dofPass',
        'database' =&gt; 'dof',
    ],
  </code></pre>
  
  <p>Apps/models/user</p>
  
  <pre><code>   &lt;?php
  use Jenssegers\Mongodb\Model as Eloquent;
  
  class User extends Eloquent {
  
      protected $collection = 'user';
      //$user = user::all();
  }
  </code></pre>
  
  <p>and Router</p>
  
  <pre><code>        Route::post('/register', function()
  {
     $user-&gt;model('User', 'App\Models\User');
     $user = new User;
  
   $user = User::create(array(
  'username' =&gt; Input::get('username'),
  'fullname' =&gt; Input::get('fullname'),
  'password' =&gt; Hash::make(Input::get('password')),
  'gender' =&gt; Input::get('gender'),
  'month' =&gt; Input::get('month'),
  'day' =&gt; Input::get('day'),
  'year' =&gt; Input::get('year'),
  'phone' =&gt; Input::get('phone'),
  'email' =&gt; Input::get('email-act'),
  'agree' =&gt; Input::get('agree')
  ));
  
      return redirect('/login');
  
  });
  </code></pre>
  
  <p>But I submit the browser is blank. Not redirect to login
  in MongoDB I just make a Collection named user.</p>