Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
3833e12c
Commit
3833e12c
authored
Nov 08, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added before and after filter methods to controller.
parent
b9e91835
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
5 deletions
+37
-5
controller.php
laravel/routing/controller.php
+37
-5
No files found.
laravel/routing/controller.php
View file @
3833e12c
...
...
@@ -137,23 +137,55 @@ abstract class Controller {
}
/**
* Set filters on the controller's methods.
* Set
"after"
filters on the controller's methods.
*
* Generally, this method will be used in the controller's constructor.
*
* <code>
* // Set a
n "auth
" before filter on the controller
* $this->
filter('before', 'auth
');
* // Set a
"foo
" before filter on the controller
* $this->
before_filter('foo
');
*
* // Set several filters on an explicit group of methods
* $this->
filter('before', 'auth|csrf
')->only(array('user', 'profile'));
* $this->
before_filter('foo|bar
')->only(array('user', 'profile'));
* </code>
*
* @param string|array $filters
* @return Filter_Collection
*/
public
function
before_filter
(
$filters
)
{
return
$this
->
filter
(
'before'
,
$filters
);
}
/**
* Set "after" filters on the controller's methods.
*
* Generally, this method will be used in the controller's constructor.
*
* <code>
* // Set a "foo" after filter on the controller
* $this->after_filter('foo');
*
* // Set several filters on an explicit group of methods
* $this->after_filter('foo|bar')->only(array('user', 'profile'));
* </code>
*
* @param string|array $filters
* @return Filter_Collection
*/
public
function
after_filter
(
$filters
)
{
return
$this
->
filter
(
'after'
,
$filters
);
}
/**
* Set filters on the controller's methods.
*
* @param string $name
* @param string|array $filters
* @return Filter_Collection
*/
p
ublic
function
filter
(
$name
,
$filters
)
p
rotected
function
filter
(
$name
,
$filters
)
{
$this
->
filters
[]
=
new
Filter_Collection
(
$name
,
$filters
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment