I am using laravel 5.0. I want login using auth laravel, but I only need to input the username when login (no need email and/or password). And I have changed the code into these below.
In my LoginController:
public function getLogin(){
if(!Auth::check()) {
return view('auth.login');
}
else{
return redirect('home');
}
}
public function postLogin(){
Auth::attempt([
'USER_NAME' => Input::get('username')
]);
return redirect('home');
}
In my User model:
<?php namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
use Authenticatable, CanResetPassword;
protected $table = 'MS_USER_ROLE';
}
And I have got an error:
ErrorException in EloquentUserProvider.php line 111: Undefined index: password
Do you know how to solve this?