Laravel - Redirect :: action - >未知的行动

时间:2013-08-04 11:37:42

标签: laravel laravel-4

路线:

Route::controller('account/pages','PagesController' );
Route::controller('account','AccountController' );    
Route::get('/', function() {
    return Redirect::to('account');
});

PagesController:

public function getGerente()
{
    return Redirect::action('GerenteController@getIndex');
}

GerenteController:

public function getIndex()
{
    return View::make('account/gerente/index');
}

查看:

<a href="{{ URL::action('PagesController@getGerente') }}">Gerente</a>

但是当点击时,返回“未知动作[GerenteController @ getIndex]”,我该如何修复?

1 个答案:

答案 0 :(得分:1)

由于您尚未为GerenteController定义路由,因此URL :: action命令不知道该怎么做。修复:

//add to your routes file
Route::controller('gerente', 'GerenteController');