Skip to content

Commit 8c974fd

Browse files
committed
docs: improve explanation
1 parent 4a4f55b commit 8c974fd

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

user_guide_src/source/incoming/filters.rst

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,29 @@ but may leave the methods empty if they are not needed. A skeleton filter class
3232
Before Filters
3333
==============
3434

35+
Replacing Request
36+
-----------------
37+
3538
From any filter, you can return the ``$request`` object and it will replace the current Request, allowing you
3639
to make changes that will still be present when the controller executes.
3740

38-
Since before filters are executed prior to your controller being executed, you may at times want to stop the
39-
actions in the controller from happening. Also, when you have a series of filters you may also want to
41+
Stopping Later Filters
42+
----------------------
43+
44+
Also, when you have a series of filters you may also want to
4045
stop the execution of the later filters after a certain filter. You can easily do this by returning
4146
**any non-empty** result. If the before filter returns an empty result, the controller actions or the later
42-
filters will still be executed. An exception to the non-empty result rule is the ``Request`` instance.
47+
filters will still be executed.
48+
49+
An exception to the non-empty result rule is the ``Request`` instance.
4350
Returning it in the before filter will not stop the execution but only replace the current ``$request`` object.
4451

52+
Returning Response
53+
------------------
54+
55+
Since before filters are executed prior to your controller being executed, you may at times want to stop the
56+
actions in the controller from happening.
57+
4558
This is typically used to perform redirects, like in this example:
4659

4760
.. literalinclude:: filters/002.php

0 commit comments

Comments
 (0)