行动形式路线

时间:2018-01-15 18:36:51

标签: laravel laravel-5

我试图启用重置密码,但我遇到了配置问题,所以我在控制器中完成了我的功能。

Route::post('/reset_password/{email}','MyController@resetPassword');

现在,在password.reset和password.email中如何路由到此/ reset_password

    <form class="form-horizontal" method="POST" action="{{ route('password.email') }}">

<form class="form-horizontal" method="POST" action="{{ route('password.request') }}">

2 个答案:

答案 0 :(得分:0)

只需为路线添加名称

Route::post('/reset_password/{email}','MyController@resetPassword')
->name('password.email');

答案 1 :(得分:0)

尝试为您的路线命名:

 Route::post('/reset_password/{email}', 'MyController@resetPassword')
        ->name('password.email');

然后在你的视图中:

<form class="form-horizontal" method="POST" 
      action="{{ route('password.email', ['email' => $email]) }}">

Named Routes documentation

或者您可以使用url helper

路线:

 Route::post('/reset_password/{email}', 'MyController@resetPassword');

查看:

 <form class="form-horizontal" method="POST" 
       action="{{ url('/reset_password/'. $email) }}">