title: laravel 4 Undefined index: password
body: <p>My code used to work properly but now there is an error </p>
  
  <blockquote>
    <p>(ErrorException (E_NOTICE)Undefined index: password)</p>
  </blockquote>
  
  <p>I really dont know why, so if you know please help me. I searched google for similar exceptions and try everything I see but still no success ... Here is my code </p>
  
  <p>route.php</p>
  
  <pre><code>Route::resource('login', 'LoginController');
  </code></pre>
  
  <p>LoginController</p>
  
  <pre><code>        public function store(){
  
          /*$credentials = array(
              'username' =&gt; Input::get('username'),
              'password' =&gt; Hash::make(Input::get('password')),
          );*/
  
          if(Auth::attempt(['active' =&gt; 1])) {
  
             // if(Auth::attempt($credentials)){
  
              if(Auth::attempt(Input::only('username', 'password'))){
  
                  return Auth::user();
                  //return Redirect::back()-&gt;with('message','You are now logged in!');
                  //return Redirect::to('/')-&gt;with('message','You are now logged in!');
              }
              else{
                  //$errors = ['password' =&gt; "Username and/or password invalid."];
                 //return Redirect::back()-&gt;withErrors($errors)-&gt;withInput(Input::except('password'));
                  return 'Failed~';
              }
          }
          else{
              //$errors = ['password' =&gt; "Please check your email to activate your account"];
              //return Redirect::back()-&gt;withErrors($errors)-&gt;withInput(Input::except('password'));
              return 'Failed~';
          }
      }
  }
  </code></pre>
  
  <p>View login/create.blade.php</p>
  
  <pre><code>@section('content')
      &lt;div class="col-lg-3"&gt;&lt;/div&gt;
      &lt;div class="form col-lg-6 box"&gt;
  
        {{ Form::open(['route' =&gt; 'login.store'], array('class' =&gt; 'form-horizontal')) }}
  
       {{--  @if ($error = $errors-&gt;first('password'))
              &lt;div class="alert alert-danger"&gt;
                  {{ $error }}
              &lt;/div&gt;
          @endif--}}
          &lt;div class="input-group form-group-md"&gt;
              &lt;span class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-user"&gt;&lt;/i&gt;&lt;/span&gt;
              {{ Form::text('username', null,['class' =&gt; 'form-control','autofocus'=&gt;'autofocus', 'placeholder' =&gt; 'Username']) }}
          &lt;/div&gt;
          &lt;div class="input-group form-group-md"&gt;
              &lt;span class="input-group-addon"&gt;&lt;i class="glyphicon glyphicon-lock"&gt;&lt;/i&gt;&lt;/span&gt;
              {{ Form::password('password', array('class' =&gt; 'form-control', 'placeholder' =&gt; 'Password')) }}
          &lt;/div&gt;
  
          &lt;div class="form-group-md"&gt;
              &lt;a href="/home" class="link"&gt;Forgot your password?&lt;/a&gt;
          &lt;/div&gt;
          &lt;div class="form-group-md"&gt;
              {{ Form::submit('Log In', array('class' =&gt; 'login navbar-btn btn-block form-control', 'autofocus'=&gt;'autofocus')) }}
          &lt;/div&gt;
  
          &lt;div class="question form-group-md"&gt;
              {{ Form::label('register', 'Do not have an account?! ') }} &lt;a href="{{ url('users/create') }}" class="link"&gt;Register here!&lt;/a&gt;
          &lt;/div&gt;
      {{ Form::close() }}
      &lt;/div&gt;
      &lt;div class="col-lg-3"&gt; &lt;/div&gt;
  @stop
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WzIiE.jpg" rel="nofollow noreferrer">error</a></p>