Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Autenticar usuarios en Laravel 5 manualmente con Auth::attempt
Route::post('login', function() {
$validator = \Validator::make(request()->all(), [
'email' => 'required',
'password' => 'required'
if ($validator->fails()) {
//mostrar errores, o en json o lo que necesites
if (\Auth::attempt(['email' => request('email'), 'password' => request('password')])) {
return redirect()->intended('¿?'));
//si estás aquí algo ha salido mal, 404, 401, 403??
})->middleware('guest'); //sólo para invitados!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment