How to apply multiple filters on Laravel 4 route group?

前端 未结 2 842
再見小時候
再見小時候 2021-01-02 11:06

Is it possible to add multiple filters on a group route in Laravel 4?

I have 2 authentification methods for an API centric application. One with standard authentific

2条回答
  •  长发绾君心
    2021-01-02 11:29

    You can do that with laravel

    Route::group(array('prefix' => 'api/', 'before' => 'filter1|filter2'), function()
    {
        Route::get('api1', function()
        {
            // Has Filter1 and filter2
        });
    
        Route::get('api2', function()
        {
            // Has filter1 and filter2
        });
    });
    

    check the documentation for more details

提交回复
热议问题