1

I'm reading the Laravel documentation and it is saying that it is possible to add a pattern based filter to a route

Route::filter('admin', function()
{
    //
});

Route::when('admin/*', 'admin');

I want to know how to specify if the filter is executed before or after the request?

1 Answer 1

2

Pattern filters are always called before and cannot be called after a routes execution.

You can see it being called in the source (4.1.24) on GitHub.

A solution to this is to have all your admin routes inside a route group and apply the filter to the entire group.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.