How to authenticate user login and password in laravel, I am trying already has some time but I can not.
Routes
Route::get('/login',['uses' => 'loginController@login','as' => 'login']);
Route::post('/login',['uses'=>'loginController@checkLogin','as' => 'VerificarLogin']);
My controller
class loginController extends Controller
{
public function login(){
return view('Inicial.login');
}
public function teste(){
return view('teste');
}
public function checkLogin(Request $request ){
$email = Input::get('email');
$password = Input::get('password');
if (Auth::attempt(['email' => $email, 'password' => $password])) {
return 1;
}
return 0;
}
My auth.php file
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'table' => 'usuarios',
'model' => App\Usuario::class,
],
My User Class
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Usuario extends Authenticatable
{
protected $fillable = ['nome','password','email','data_nascimento','rg','funcao','telefone'];
protected $table = 'usuarios';
}'
And my form galera
<form class="form-horizontal new-lg-form" id="loginform" action="{{ route('VerificarLogin') }}" method="post">
{{ csrf_field() }}
<div class="form-group m-t-20">
<div class="col-xs-12">
<label>Endereço de Email</label>
<input class="form-control" type="text" required="" placeholder="Email" id="email" name="email">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<label>Senha</label>
<input class="form-control" type="password" required="" placeholder="Senha" id="senha" name="password">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<div class="checkbox checkbox-info pull-left p-t-0">
<input id="checkbox-signup" type="checkbox">
<label for="checkbox-signup"> Lembrar-me </label>
</div>
<a href="javascript:void(0)" id="to-recover" class="text-dark pull-right"><i class="fa fa-lock m-r-5"></i> Esqueceu a senha ?</a> </div>
</div>
<div class="form-group text-center m-t-20">
<div class="col-xs-12">
<button class="btn btn-info btn-lg btn-block btn-rounded text-uppercase waves-effect waves-light" type="submit">Entrar</button>
</div>
</div>
</form>
In my verification I can never log in or log in. If someone has a similar project send the link to me to look or download