mercredi 2 mars 2016

Undefined method ::validate in laravel

working in recover the password, and everything was working ok since i added a validator, but i get a error: "Undefined method ...\Password\PasswordController::validate"

The function im calling is postEmail

What am i doing wrong?

My code:

namespace Illuminate\Foundation\Auth; use Illuminate\Http\Request; use Illuminate\Mail\Message; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Password; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

trait ResetsPasswords { use RedirectsUsers;

/**
 * Send a reset link to the given user.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function postEmail(Request $request)
{


    $this->validate($request, ['email' => 'required|email']);


    $response = Password::sendResetLink($request->only('email'), function (Message $message) {
        $message->subject($this->getEmailSubject());
    });


    switch ($response) {
        case Password::RESET_LINK_SENT:
            return redirect()->back()->with('status', trans($response));

        case Password::INVALID_USER:
            return redirect()->back()->withErrors(['email' => trans($response)]);
    }
}
}



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

Aucun commentaire:

Enregistrer un commentaire