Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Autenticar usuarios en Laravel 5 manualmente
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
$userData = \App\User::where('email',request('email'))->first();
if ($userData && \Hash::check(request('password'), $userData->password))
//log que necesites
//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