Php Laravel筛选路由:在子集合上时

Php Laravel筛选路由:在子集合上时,php,laravel,Php,Laravel,我试图使用Route:when在子集合中添加一个过滤器,但它不会触发 这是一个例子 网址 第一次收集时的工作路线 Route::when('firstcollection/*', 'auth_token', array('put')); www.domain.com/firstcollection 但当我尝试使用用户路由时:当在子集合上时,过滤器不会触发 Route::when('firstcollection/{id}/subcollection/*', 'auth_token', arr

我试图使用Route:when在子集合中添加一个过滤器,但它不会触发

这是一个例子

网址

第一次收集时的工作路线

Route::when('firstcollection/*', 'auth_token', array('put')); 
www.domain.com/firstcollection
但当我尝试使用用户路由时:当在子集合上时,过滤器不会触发

Route::when('firstcollection/{id}/subcollection/*', 'auth_token', array('post'));
www.domain.com/firstcollection/id/subcollection
下面是完整的代码

Route::filter('auth_token', function(){
//some logic here
}); 

Route::when('firstcollection/*', 'auth_token', array('put')); 
Route::when('firstcollection/{id}/subcollection/*', 'auth_token', array('post'));

试着改变这两条路线。否则,第一个通配符也将捕获第二条路径

Route::when('firstcollection/{id}/subcollection/*', 'auth_token', array('post'));
Route::when('firstcollection/*', 'auth_token', array('put')); 
另外,我认为你不能在“when”子句中使用{id}。系统正在寻找firstcollection/{id}/subcollection的实际url,但这不起作用。但是,由于您使用的是post和put,这将起作用

Route::when('firstcollection/*', 'auth_token', array('post, put'));

不起作用。同样的结果。我甚至删除了firstcollection路由:何时。您是否在表单上使用“put”方法以允许它甚至到达路由?我在子集合上使用“POST”方法在您的问题中发布您的表单。您的表单代码-而不是表单本身。告诉我您在哪里/如何执行表单::open()
Route::when('firstcollection/*', 'auth_token', array('post, put'));