jeudi 27 octobre 2016

Laravel where clause not working properly

i am using Where clause in laravel but it does not seem to be working properly .

Code

$login = User::where(
                [
                    ['email', '=', Input::get('email')],
                    ['password', '=', md5(Input::get('password'))],
                ])->get();

           if ($login === null)
        {
            $finalResult = array('code' => 100,
                'msg' => 'Your Account Does not exist.',
                'data' => array()
                );          
        }
        else
        {
            $data = User::where(
                 [ 'email'    =>Input::get('email')],
                 [ 'password' =>md5(Input::get('password'))]
                 )->get();
            $finalResult = array('code' => 100,
                'msg' => 'Your Account is found.',
                'data' => $data
                );
        }

    }   

When i provide email and password it returns data against the email even when we provide wrong password .

I don't know what i am doing wrong here .

Thank You for your answers



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire