I'm having trouble logging in to the user in Laravel.
Look, it does not log in to the user, but it also does not return an error:
auth.php
return array(
'driver' => 'eloquent',
'model' => 'Cliente',
'table' => 'cliente',
'reminder' => array(
'email' => 'emails.auth.reminder',
'table' => 'password_reminders',
'expire' => 60,
),
);
My Model Client.php
<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class Cliente extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
protected $table = 'cliente';
protected $hidden = array('password', 'remember_token');
protected $fillable = [/*Meus campos*/];
public function getAuthIdentifier(){
return $this->getKey();
}
public function getAuthPassword(){
return $this->password;
}
}
My Controller AuthController.php
class AuthController extends BaseController{
public function __construct(){}
public function postLogin(){
$credentials = [
'email' => Input::get('email'),
'password' => Input::get('password')
];
if(Auth::attempt($credentials,false)){
return Redirect::to('/reserva');
}
return Redirect::to('/')
->with('message','Erro ao se logar, verifique o e-mail ou senha digitado.');
}
public function getLogout(){
Auth::logout();
return Redirect::to('login');
}
}
My view:
{{ Form::open(['url' => 'auth/login','method' => 'post']) }}
@if(Session::has('message'))
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif
{{ Form::text('email'); }}
{{ Form::password('password'); }}
{{ Form::submit('Acessar') }}
{{ Form::close() }}