Skip to content

Instantly share code, notes, and snippets.

@wjaspers
Created December 30, 2014 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wjaspers/d1d36cea26f700b6d94d to your computer and use it in GitHub Desktop.
Save wjaspers/d1d36cea26f700b6d94d to your computer and use it in GitHub Desktop.
ServiceProvider::when loses events
<?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