mercredi 22 août 2018

Laravel: if not working correctly

I have a login on my website, but the auth() check in combination with the if statement is not working correctly.

After some weird errors, I checked the output of the check in the if:

public function store()
    {
        $check = (! (auth()->attempt(request(['id', 'password']))));

        if($check);
        {
            dd($check);
            return back()->withErrors([
                'message' => 'Überprüfen Sie Ihre Angabe und versuchen Sie es noch einmal.'
            ]);
        }

        return redirect()->home();
}

The output for check is always FALSE, but it shouldn't even come to the output then?!

When I don't dd(), the user is logged in, but with an error.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire