Php &引用;路由[user.update]未定义“;但存在于资源控制器Laravel 4中

Php &引用;路由[user.update]未定义“;但存在于资源控制器Laravel 4中,php,forms,laravel-4,Php,Forms,Laravel 4,用户控制器: protected $user; public function __construct(User $user) { $this->user = $user; } public function edit($id) { $user = $this->user->find($id); return View::make('users.edit')->with('current',$current)->with('user',$

用户控制器:

protected $user;

public function __construct(User $user)
{
    $this->user = $user;
}

public function edit($id)
{
    $user = $this->user->find($id);
    return View::make('users.edit')->with('current',$current)->with('user',$user);
}

public function update($id)
{
    $user = $this->user->find($id);
    ....
    return Redirect::route('users.index');
}
型号:

protected $table = 'users';
路线:

Route::resource('users','UsersController');
生成到路由的链接(在../views/users/show中):

edit.blade.php中的表单模型:

    {{ Form::model($user, array('route'=>array('user.update',$user->id))) }}
链接到/users/edit会引发此异常:

未定义路由[user.update]。(视图:…/app/views/users/edit.blade.php)


我不明白为什么在UsersController中没有明确定义路由。我做错了什么?谢谢

您是否在CLI中尝试了
php artisan路由
?只是将
user.update
更改为
users.update
用于
Form::model()
声明中的路由。@rmclood:这太简单了!哈我想让你们知道,你们可以查看路线以备将来参考:)谢谢你们两位——现在我真的很傻,因为我错过了。我想我累了。。。但是现在用户/编辑正在加载(数据绑定工作!),还有另一个问题:尽管扩展了与原始用户/创建页面相同的布局文件,但此页面的CSS没有加载。用户id插入到用户和编辑(users/{$id}/edit)之间的事实是否就好像添加了一个新目录,因此需要CSS文件的新路径?是的,刚才回答了我自己的问题——生成的URL确实需要一个新路径。
    {{ Form::model($user, array('route'=>array('user.update',$user->id))) }}