Laravel, Route required parameter is not validating by Form Request Validation -
i using laravel 5.4
routes/web.php [route]
route::get('/email-confirmation/{token}', ['uses' => 'components\confirmationcontroller@sendemailconfirmation', 'as' => 'web.email.confirmation']);
components/confirmationcontroller.php [controller]
public function sendemailconfirmation(emailconfirmationrequest $request) { dd($request->input('token')); // ouput empty }
// know that, route required parameter access passing in second parameter
emailconfirmationrequest.php [request]
public function rules() { return ['token' => 'required|max:3']; }
url : /email-confirmation/hello - not validating
so, cannot validated token
parameter in request.
i not sure, doing wrong.
as of comments have said, passing $token
route parameter, not input value.
to use route parameter update method (adding $token
)
public function sendemailconfirmation(emailconfirmationrequest $request, $token) { dd($token); // output should $token value }
if want pass input can add hidden field in form.
Comments
Post a Comment