在 routes.php 定义了 一个 RESTful
Route::resource('com','ComController');
在 ComController.php
里面 定义了如下方法
public function index()
{
return "index";
}
public function show()
{
return "show";
}
public function edit($id)
{
return "edit".$id;
}
public function del($id)
{
return "del".$id;
}
$id
都会报错
有什么好的方法 可以 定义好一个路由对应一个控制器
控制器下面的方法 不用再路由上定义呢
Route::controllers([
'com' => 'ComController',
]);
用此路由 怎么传 $id
呢
路由的 RESTful
方法 和 controllers
有什么区别呢
求大神指点一下啊
你的需求应该是这个:
http://laravel.com/docs/5.0/controllers#implicit-controllers
routes.php
UserController.php