路线:
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]”,我该如何修复?
答案 0 :(得分:1)
由于您尚未为GerenteController定义路由,因此URL :: action命令不知道该怎么做。修复:
//add to your routes file
Route::controller('gerente', 'GerenteController');