mercredi 15 février 2017

How to validate credentials using \Auth::guard("api")->user() object

My request class is below

class ChangePasswordRequest extends Request 
{
    public function authorize() {
        return true;
    }

    public function rules() {

        return [
            'EmailAddress'              =>  'required',
            'Password'                  =>  'required',
            'NewPassword'               =>  'required|min:8|confirmed',
            "NewPassword_confirmation"  =>  'required|min:8',
        ];

    }
}

In the above request class scope I found that I have access to complete user object using the below code

\Auth::guard("api")->user()

I could access input fields like this: dd($this["EmailAddress"]); dd($this["Password"]);

Is there any way to validate the EmailAddress and Password fields without going to database? Can we do in inside the rule?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lj0ILe
via IFTTT

Aucun commentaire:

Enregistrer un commentaire