您好我遇到了一些问题,我创建了一个控制器并在我的路线中注册了它,但是当我尝试浏览它的页面时,我一直收到错误。默认的show,create,destroy和update方法仍然有效但我创建的方法不起作用我希望我知道我做错了什么。
错误:
`Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
Controller method not found.`
我的路线:
Route::Resource("impactnetwork","impactController");
Route::get("impactnetwork/itinerary","impactController@itinerary");
Route::get("impactnetwork/gallery","impactController@gallery");
Route::get("impactnetwork/lead","impactController@lead");
我的控制器:
`public function itinerary()
{
return View::make("pages/impactitinerary");
}
public function gallery()
{
return View::make("pages/impactgallery");
}
public function lead()
{
return View::make("pages/impactlead");
}
`
我试着brwose:
www.mysite.dev/impactnetwork/itinerary
www.mysite.dev/impactnetwork/gallery
www.mysite.dev/impactnetwork/lead
但它一直在说"未找到控制器方法"
答案 0 :(得分:4)
Route::resource("impactnetwork","impactController");
这将您的控制器定义为资源控制器,其操作数量有限。