application.php 832 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php namespace Laravel;
  2. class Application {
  3. /**
  4. * The active request instance.
  5. *
  6. * @var Request
  7. */
  8. public $request;
  9. /**
  10. * The application configuration manager.
  11. *
  12. * @var Config
  13. */
  14. public $config;
  15. /**
  16. * The application session driver.
  17. *
  18. * @var Session\Driver
  19. */
  20. public $session;
  21. /**
  22. * The application IoC container.
  23. *
  24. * @var Container
  25. */
  26. public $container;
  27. /**
  28. * Magic Method for resolving core classes out of the IoC container.
  29. */
  30. public function __get($key)
  31. {
  32. if ($this->container->registered('laravel.'.$key))
  33. {
  34. return $this->container->resolve('laravel.'.$key);
  35. }
  36. elseif ($this->container->registered($key))
  37. {
  38. return $this->container->resolve($key);
  39. }
  40. throw new \Exception("Attempting to access undefined property [$key] on application instance.");
  41. }
  42. }