路由[RemindersController@postRemind]未定义错误在Laravel4


Route [RemindersController@postRemind] not defined error in Laravel4

我正在实现Laravel的密码提醒功能,但遇到这个错误:

Route [RemindersController@postRemind]未定义。

我正在使用Laravel 4,绝对是Laravel的新手。我用

php artisan auth:reminders-controller

创建RemindersController

   <?php
   class RemindersController extends Controller {
  public function getRemind()
  {
    return View::make('password_remind');
  }
public function postRemind()
{
   Password::remind(Input::only('email'), function($message)
  {
     $message->subject('Password Reminder');
  });                
}
public function getReset($token = null)
{
    if (is_null($token)) App::abort(404);
    return View::make('password.reset')->with('token', $token);
}
public function postReset()
{
    $credentials = Input::only(
        'email', 'password', 'password_confirmation', 'token'
    );
    $response = Password::reset($credentials, function($user, $password)
    {
        $user->password = Hash::make($password);
        $user->save();
       });
       switch ($response)
       {
        case Password::INVALID_PASSWORD:
        case Password::INVALID_TOKEN:
        case Password::INVALID_USER:
            return Redirect::back()->with('error', Lang::get($response));
        case Password::PASSWORD_RESET:
            return Redirect::to('/');
        }
     }
   }

我创建了视图password_remind.blade.php,如下所示:

 @extends('layouts.default_layout')
 @section('content')
     <div class="row" style="min-height: 376px">
       <div class="col-sm-4">
       </div>
       <div class="col-sm-4">
       </div>
       <div class="col-sm-4" style="padding-top: 70px;">
        <div class="login">
           <form action="{{action('RemindersController@postRemind')}}" method="POST">
               <input type="email" name="email" placeholder="Email">
                <input type="submit" value="Send">
            </form> 
        </div>
       </div> 
     </div>
 @stop

在根中我添加了Route::get('forgotPassword', 'RemindersController@getRemind');url http://localhost/laravel_work/public/forgotPassword给出

Route [RemindersController@postRemind] not defined

错误。我哪里错了?我找不到错误。请帮帮我:(*

如果你看一下你的表单你有action="{{action('RemindersController@postRemind')}}"

但是根据你的说法,你添加的唯一路线是RemindersController@getRemind

我假设你只是想要get现在快速检查视图,但也许action()实际上急切地寻找不存在的路由。

当你发布表单或当你获得视图时,你的应用程序会死亡吗?无论哪种方式,为post定义路由,就像您对get所做的那样,应该可以解决这个问题。