似乎您的密码不正确,因为您不处理这种情况。那将解释黑屏。尝试添加类似这样的东西,看看它是否进入那里。
我可以像这样突出显示的那样登录我的第二个用户
但是第一个,我无法登录,这是我的代码,]
public function postLogin(Request $request) { // -> Validate the request. $this->validate(request(), [ 'pin' => 'required|string', 'password' => 'required|string', ]); $pin = request()->get('pin'); $field = filter_var(request()->get('pin'), FILTER_VALIDATE_EMAIL) ? 'email' : 'username'; $remember_me = request()->get('remember'); $password = request()->get('password'); $user = User::where("${field}",'=',$pin)->first(); // dd($user); if ( is_null($user->confirmed_at) || $user->status === "0") { return redirect()->back()->with('flash-message','The account you tried to login was either not yet confirmed by you or activated by one of our admins.'); } else { if (Auth::attempt([$field => $pin ,'password' => $password])){ // dd(auth()->user()->role_id); switch(auth()->user()->role_id){ /*the roles would be determined*/ case 1 : return redirect()->route("admin.dashboard"); case 2 : return redirect()->route("admin.dashboard"); case 3 : return redirect()->to('/'); } } } }
登录后以及dd的结果显示时,我都会显示白屏>
$user = User::where("${field}",'=',$pin)->first();
状态字段是
enum
字段
这里是展开的
我可以像这样突出显示的那样登录我的第二个用户,但是第一个用户,我不能登录,这是我的那个公共功能的代码postLogin(Request $ request){//->验证...
] >似乎您的密码不正确,因为您不处理这种情况。那将解释黑屏。尝试添加类似这样的东西,看看它是否进入那里。
if (Auth::attempt([$field => $pin ,'password' => $password])){
// dd(auth()->user()->role_id);
switch(auth()->user()->role_id){
/*the roles would be determined*/
case 1 : return redirect()->route("admin.dashboard");
case 2 : return redirect()->route("admin.dashboard");
case 3 : return redirect()->to('/');
}
} else {
dd('Auth failed!');
}
似乎您的密码不正确,因为您不处理这种情况。那将解释黑屏。尝试添加类似这样的东西,看看它是否进入那里。