我正在使用 Laravel 4。我正在尝试使用命名路由。以下 url 给出了“找不到控制器方法”错误。我将不胜感激。
我知道路由顺序很重要,最深的 url 应该首先出现,因此我当前的 route.php 看起来:
Route::get('student/{id}', array('as'=>'student.practice' , 'uses'=>'StudentsController@practice'));
Route::controller('users', 'UsersController');
Route::controller('students', 'StudentsController');
我试过改变顺序。没什么区别。
我的 StudentController 确实有一个 getPractice 方法。
public function getPractice($id)
{
return View::make('students.practice')
->with('student', Student::find($id));
}