Created
December 30, 2014 19:07
-
-
Save wjaspers/d1d36cea26f700b6d94d to your computer and use it in GitHub Desktop.
ServiceProvider::when loses events
This file contains 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\Support\ServiceProvider; | |
class MyServiceProvider extends ServiceProvider | |
{ | |
protected $defer = true; | |
public function register() | |
{ | |
$this->app->view->composer('module.myviews.showAnObject', 'MyModule\Views\ShowAnObjectViewComposer'); | |
$this->app->view->composer('module.myviews.createAnObject', 'MyModule\Views\CreateAnObjectViewComposer'); | |
} | |
public function when() | |
{ | |
return [ | |
'creating: module.myviews.*', // The wildcardListen() will set this up | |
'creating: module.myviews.createAnObject' // And bypass everyone after it. | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment