Usando ajax Laravel para login

public function login_app(Request $request) {
$auth = false;
$credentials = $request->only('email', 'password');

if (Auth::attempt($credentials, $request->has('remember'))) {
$auth = true; // Success
}

if ($request->ajax()) {
return response()->json([
'situacao' => $auth,
'intended' => URL::previous()
]);
} else {
return redirect()->intended(URL::route('/home'));
}
return redirect(URL::route('/login'));
}

Comentários

Postagens mais visitadas deste blog

Instalação NetBeans