Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // Laravel 4.2 DI
  2. class MyController extend Controller{
  3.  
  4. protected $someDI, $someFoo;
  5.  
  6. public function __constructor(\SomeDI $someDI, \SomeFoo $someFoo)
  7. {
  8. $this->someDI = $someDI;
  9. $this->someFoo = $someFoo
  10. }
  11.  
  12. public function someFoo()
  13. {
  14. $this->someDI = 'Class Wide DI';
  15. $this->someFoo = 'Hello this is class wide but only used in this method';
  16. }
  17.  
  18.  
  19. // Laravel 5 MI
  20.  
  21. class MyController extend Controller{
  22.  
  23. protected $someDI;
  24.  
  25. public function __constructor(\SomeDI $someDI)
  26. {
  27. $this->someDI = $someDI;
  28. }
  29.  
  30. public function someFoo(\SomeFoo $someFoo)
  31. {
  32. $this->someDI = 'Class Wide DI';
  33. $this->someFoo = 'Hello this is only available in this method';
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement