check()){ return redirect("/dashboard"); } return view("login"); } public function doLogin(Request $request, AuthApps $authApps, APIInterface $API){ $data["username"] = $request->get("username"); $data["password"] = $request->get("password"); // dd($data); // dd($request->all()); $result = $API->post("auth/login" , $data); // dd($result); if ($result->rc == 200){ $authApps->add($result->data->token); return redirect("/dashboard"); }else{ return redirect()->back()->withErrors(['errorLogin' => $result->rm]); } } public function logoutEx(AuthApps $authApps){ $authApps->clear(); return redirect("/"); } public function check(APIInterface $API){ // $API->doPost(); // $authApps->clear(); return redirect("/"); } }