title: Simple insert using eloquent in Laravel 4
body: <p>I am trying to insert single data into db in Laravel 4 but failed to do so after trying for 3 hrs.</p>
  
  <p>Below is code snippet,</p>
  
  <p><strong>Model</strong></p>
  
  <p><strong>User.php</strong></p>
  
  <pre><code>class User extends Eloquent
  {
    protected $table='users';
    protected $protected = array();
  }
  </code></pre>
  
  <p><strong>Migration</strong></p>
  
  <pre><code>class CreateUserInfoTable extends Migration {
  
  /**
   * Run the migrations.
   *
   * @return void
   */
  public function up()
  {
      Schema::create('users', function($table)
      {
          $table-&gt;increments('id');
          $table-&gt;string('name');
          $table-&gt;string('cntNo');
          $table-&gt;timestamps();
      });
  }
  
  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
      Schema::drop('users');
  }
  
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <p><strong>UserController.php</strong></p>
  
  <pre><code>public function post_create()
  {
      User::create(array('name'=&gt;Input::get('name'),'cntNo'=&gt;Input::get('cntno')));
  }
  </code></pre>
  
  <p><strong>Routes.php</strong></p>
  
  <pre><code>Route::post('new/create', array('uses'=&gt;'UserController@post_create'));
  </code></pre>
  
  <p>But I am not able to even insert into database.</p>
  
  <p><strong>app-->config-->database.php</strong></p>
  
  <pre><code>&lt;?php
  
  return array(
  
  /*
  |--------------------------------------------------------------------------
  | PDO Fetch Style
  |--------------------------------------------------------------------------
  |
  | By default, database results will be returned as instances of the PHP
  | stdClass object; however, you may desire to retrieve records in an
  | array format for simplicity. Here you can tweak the fetch style.
  |
  */
  
  'fetch' =&gt; PDO::FETCH_CLASS,
  
  /*
  |--------------------------------------------------------------------------
  | Default Database Connection Name
  |--------------------------------------------------------------------------
  |
  | Here you may specify which of the database connections below you wish
  | to use as your default connection for all database work. Of course
  | you may use many connections at once using the Database library.
  |
  */
  
  'default' =&gt; 'mysql',
  
  /*
  |--------------------------------------------------------------------------
  | Database Connections
  |--------------------------------------------------------------------------
  |
  | Here are each of the database connections setup for your application.
  | Of course, examples of configuring each database platform that is
  | supported by Laravel is shown below to make development simple.
  |
  |
  | All database work in Laravel is done through the PHP PDO facilities
  | so make sure you have the driver for your particular database of
  | choice installed on your machine before you begin development.
  |
  */
  
  'connections' =&gt; array(
  
      'sqlite' =&gt; array(
          'driver'   =&gt; 'sqlite',
          'database' =&gt; __DIR__.'/../database/production.sqlite',
          'prefix'   =&gt; '',
      ),
  
      'mysql' =&gt; array(
          'driver'    =&gt; 'mysql',
          'host'      =&gt; 'localhost',
          'database'  =&gt; 'laravel_user',
          'username'  =&gt; 'root',
          'password'  =&gt; 'sa',
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix'    =&gt; '',
      ),
  
      'pgsql' =&gt; array(
          'driver'   =&gt; 'pgsql',
          'host'     =&gt; 'localhost',
          'database' =&gt; 'forge',
          'username' =&gt; 'forge',
          'password' =&gt; '',
          'charset'  =&gt; 'utf8',
          'prefix'   =&gt; '',
          'schema'   =&gt; 'public',
      ),
  
      'sqlsrv' =&gt; array(
          'driver'   =&gt; 'sqlsrv',
          'host'     =&gt; 'localhost',
          'database' =&gt; 'database',
          'username' =&gt; 'root',
          'password' =&gt; '',
          'prefix'   =&gt; '',
      ),
  
  ),
  
  /*
  |--------------------------------------------------------------------------
  | Migration Repository Table
  |--------------------------------------------------------------------------
  |
  | This table keeps track of all the migrations that have already run for
  | your application. Using this information, we can determine which of
  | the migrations on disk haven't actually been run in the database.
  |
  */
  
  'migrations' =&gt; 'migrations',
  
  /*
  |--------------------------------------------------------------------------
  | Redis Databases
  |--------------------------------------------------------------------------
  |
  | Redis is an open source, fast, and advanced key-value store that also
  | provides a richer set of commands than a typical key-value systems
  | such as APC or Memcached. Laravel makes it easy to dig right in.
  |
  */
  
  'redis' =&gt; array(
  
      'cluster' =&gt; false,
  
      'default' =&gt; array(
          'host'     =&gt; '127.0.0.1',
          'port'     =&gt; 6379,
          'database' =&gt; 0,
      ),
  
  ),
  
  );
  </code></pre>
  
  <p><strong>Screenshot</strong></p>
  
  <p><img src="https://i.stack.imgur.com/iKq8k.jpg" alt="enter image description here"></p>
  
  <p>Latest One after setting debug => true in <strong>app.php</strong></p>
  
  <p><img src="https://i.stack.imgur.com/uNcnt.jpg" alt="enter image description here"></p>