Created
January 12, 2014 17:10
-
-
Save fedeisas/8387519 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Illuminate\Routing\Controller; | |
| class BaseController extends Controller | |
| { | |
| public function __construct() | |
| { | |
| $this->beforeFilter(function() | |
| { | |
| Event::fire('clockwork.controller.start'); | |
| }); | |
| $this->afterFilter(function() | |
| { | |
| Event::fire('clockwork.controller.end'); | |
| }); | |
| } | |
| /** | |
| * Setup the layout used by the controller. | |
| * | |
| * @return void | |
| */ | |
| protected function setupLayout() | |
| { | |
| if (!is_null($this->layout)) { | |
| $this->layout = View::make($this->layout); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class HomeController extends \BaseController | |
| { | |
| protected $currentUser; | |
| public function __construct() | |
| { | |
| parent::__construct(); | |
| $this->currentUser = App::make('CurrentUser'); | |
| } | |
| public function getIndex() | |
| { | |
| $currentUser = $this->currentUser; | |
| Clockwork::info('Message text.'); | |
| return View::make('home.index', compact('currentUser')); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment