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
f9bc3cc2
Commit
f9bc3cc2
authored
Jan 16, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added before and after methods to the base controller.
parent
f9924e41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
controller.php
laravel/routing/controller.php
+24
-2
No files found.
laravel/routing/controller.php
View file @
f9bc3cc2
...
...
@@ -136,7 +136,7 @@ abstract class Controller {
// If the controller's bundle is not the application bundle, we will
// prepend the bundle to the identifier so the bundle is prefixed to
// the class name when it is formatted. Bundle controllers are
// always prefixed with the bundle
's name by convention
.
// always prefixed with the bundle
name
.
if
(
$bundle
!==
DEFAULT_BUNDLE
)
$controller
=
$bundle
.
'.'
.
$controller
;
return
Str
::
classify
(
$controller
)
.
'_Controller'
;
...
...
@@ -159,11 +159,18 @@ abstract class Controller {
if
(
is_null
(
$response
))
{
$this
->
before
();
$response
=
$this
->
response
(
$method
,
$parameters
);
}
$response
=
Response
::
prepare
(
$response
);
// The "after" function on the controller is simply a convenient hook
// so the developer can work on the response before it's returned to
// the browser. This is useful for setting partials on the layout.
$this
->
after
(
$response
);
Filter
::
run
(
$this
->
filters
(
'after'
,
$method
),
array
(
$response
));
return
$response
;
...
...
@@ -265,7 +272,22 @@ abstract class Controller {
}
/**
* Magic Method to handle calls to undefined functions on the controller.
* This function is called before the action is executed.
*
* @return void
*/
public
function
before
()
{}
/**
* This function is called after the action is executed.
*
* @param Response $response
* @return void
*/
public
function
after
(
$response
)
{}
/**
* Magic Method to handle calls to undefined controller functions.
*/
public
function
__call
(
$method
,
$parameters
)
{
...
...
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