title: How to update a record in Laravel Eloquent?
body: <p>I'm new to learning Laravel 5. I'm following a tutorial and I have the following code in my controller. What I want is to update the username with <code>ID=10</code> in my login database. I follow the tutorial and also the Laravel documentation but what happens is it inserts another record instead of updating the existing. What is wrong with my code?</p>
  
  <p>Routes.php:</p>
  
  <pre><code>Route::get('/users', "PagesController@login");
  </code></pre>
  
  <p>login.php (model)</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class login extends Model
  {
      public $timestamps = false;
      protected $table = 'login';
  
      protected $fillable = [
          'username',
          'password'
      ];    
  }
  </code></pre>
  
  <p>PagesController.php</p>
  
  <pre><code>&lt;?php
  
      namespace App\Http\Controllers;
  
      use Illuminate\Http\Request;
      use App\login; //added
      use App\Http\Requests;
      use App\Http\Controllers\Controller;
  
      class PagesController extends Controller
      {
         public function login()
          {
            $login = new login;
            $login::find(10);
            $login-&gt;username ='updated_username';
            $login-&gt;save();
          }
      }
  </code></pre>