php - Laravel Form Request not being passed to argument -
i'm busy migrating app laravel 4.2 5.1, , experiencing issue form requests. it's simple i'm missing - not sure.
the method below meant attempt sign in if signinrequest
authorises request. however, if validation passes, signinrequest
not passed attemptsignin
, throws process off error:
argument 2 passed app\http\controllers\auth\authcontroller::attemptsignin() must instance of app\http\requests\signinrequest, none given
this method (controller authcontroller
) in question, tries sign in using username or email address:
public function attemptsignin($type = 'regular', signinrequest $request) { switch ($type) { case 'regular': $identifierfieldname = 'account_identifier'; $field = filter_var($request->input($identifierfieldname), filter_validate_email) ? 'email' : 'username'; $request->merge([$field => $request->input($identifierfieldname)]); $specifics = $request->only($field, 'passphrase'); $specifics['activated'] = (int) true; if ($this->auth->attempt($specifics)) { return redirect()->intended($this->redirectpath); } else { return redirect($this->signinpath) ->with('autherror', "the credentials you've provided incorrect.") ->with('autherrortype', 'warning') ->withinput($request->only($identifierfieldname)) ->witherrors(); } break; case 'oota': break; default: return redirect($this->signinpath); break; } }
the form request straight-forward, specifying rules
, messages
, authorize
(return true
).
if validation fails, however, signinrequest
passed method, , errors shown accordingly.
am missing here?
use \path\to\your\classrequest myrequest
or
protected $myrequest; public function __construct(\path\to\your\classrequest $request){ $this -> myrequest = $request; // use directly in method or method }
hope help.
public function post_form(myrequest $request) { code here }
Comments
Post a Comment