我不确定最好的方法是什么,所以将当前内容与一个数组进行比较只是我目前想到的。
我希望有一组路由执行一个过滤器,然后根据路由从该过滤器得到不同的结果。大致如下:
if(in_array($currentRoute, $allowedRoutes){
do action1
}
else{
do action2
}
就URI而言,我有许多不同的可能性。
Route::get('/content','ContentController@index')
Route::post('/dynamic/{dynamic}','DynamicController@store')
Route::delete('dynamic/{dynamic}/content/{content}','ContentController@destroy')
以上所有内容都可能有查询字符串,并且都具有多种HTTP方法。如何最好地处理这个问题呢?