私のコードは正常に動作するために使用されるが、今でエラーがlaravel 4未定義のインデックス:パスワード
(ErrorException(E_NOTICE)未定義のインデックス:パスワード)があるので、私は本当に理由を知らない
を、あなたが私を助けてください知っている場合。私は同様の例外についてはグーグルを検索し、私が見るすべてのものが、まだありません成功を試してみてください...ここで
Route::resource('login', 'LoginController');
LoginController
public function store(){
/*$credentials = array(
'username' => Input::get('username'),
'password' => Hash::make(Input::get('password')),
);*/
if(Auth::attempt(['active' => 1])) {
// if(Auth::attempt($credentials)){
if(Auth::attempt(Input::only('username', 'password'))){
return Auth::user();
//return Redirect::back()->with('message','You are now logged in!');
//return Redirect::to('/')->with('message','You are now logged in!');
}
else{
//$errors = ['password' => "Username and/or password invalid."];
//return Redirect::back()->withErrors($errors)->withInput(Input::except('password'));
return 'Failed~';
}
}
else{
//$errors = ['password' => "Please check your email to activate your account"];
//return Redirect::back()->withErrors($errors)->withInput(Input::except('password'));
return 'Failed~';
}
}
}
見るログイン/ create.blade
route.php私のコードです.PHP
@section('content')
<div class="col-lg-3"></div>
<div class="form col-lg-6 box">
{{ Form::open(['route' => 'login.store'], array('class' => 'form-horizontal')) }}
{{-- @if ($error = $errors->first('password'))
<div class="alert alert-danger">
{{ $error }}
</div>
@endif--}}
<div class="input-group form-group-md">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
{{ Form::text('username', null,['class' => 'form-control','autofocus'=>'autofocus', 'placeholder' => 'Username']) }}
</div>
<div class="input-group form-group-md">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
{{ Form::password('password', array('class' => 'form-control', 'placeholder' => 'Password')) }}
</div>
<div class="form-group-md">
<a href="/home" class="link">Forgot your password?</a>
</div>
<div class="form-group-md">
{{ Form::submit('Log In', array('class' => 'login navbar-btn btn-block form-control', 'autofocus'=>'autofocus')) }}
</div>
<div class="question form-group-md">
{{ Form::label('register', 'Do not have an account?! ') }} <a href="{{ url('users/create') }}" class="link">Register here!</a>
</div>
{{ Form::close() }}
</div>
<div class="col-lg-3"> </div>
@stop
このエラーいいえ? – Naincy