Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Providers;
  4.  
  5. use Illuminate\Support\ServiceProvider;
  6.  
  7. class AppServiceProvider extends ServiceProvider
  8. {
  9. public function boot()
  10. {
  11. $this->app['hooks']->listen('hook1', function () {
  12. return view('hook1-a');
  13. });
  14.  
  15. $this->app['hooks']->listen('hook1', 'App\Hook1Listener@handle');
  16.  
  17. $this->app['hooks']->listen('hook2', function () {
  18. return view('hook2-a');
  19. });
  20. }
  21.  
  22. public function register()
  23. {
  24. $this->app->singleton('hooks', function ($app) {
  25. return new \App\HookManager;
  26. });
  27.  
  28. $this->app['hooks']->add('hook1');
  29. $this->app['hooks']->add('hook2');
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement