Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

uselaravel's avatar

I have sentinel authenticate problem ?

This is my code;

public function postLogin(Request $request){

    $validator = Validator::make($request->all(), $this->loginDataRules(), $this->loginMessages()); 
    if ($validator->fails()) {

        $request->flash();
        return redirect()->back()->withErrors($validator);
    }else{
        
        
        $signinfo = $this->signinfo();
        if ($signinfo == true)
        {
            return view('profile');
        }
        else
        {
            
            Sentinel::authenticate($request->all()); // *** I want to expand this code. ***
            return redirect('/account');
            
        }
        
        
    }
   
}

Expansion for Sentinel. I want to return an error message if the email or password is entered incorrectly.

0 likes
4 replies
Sinnbeck's avatar
if(! Sentinel::authenticate($request->all()) {
    throw new Exception; //or return a response with an error code 
}
1 like
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

According to the docs it returns either the Cartalyst\Sentinel\Users\UserInterface or false.

My guess is that false is for when it fails. So if it fails you throw an error

1 like

Please or to participate in this conversation.