controller.php 975 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php namespace Laravel;
  2. abstract class Controller {
  3. /**
  4. * The IoC container instance.
  5. *
  6. * @var Container
  7. */
  8. public $container;
  9. /**
  10. * A stub method that will be called before every request to the controller.
  11. *
  12. * If a value is returned by the method, it will be halt the request cycle
  13. * and will be considered the response to the request.
  14. *
  15. * @return mixed
  16. */
  17. public function before() {}
  18. /**
  19. * Magic Method to handle calls to undefined functions on the controller.
  20. *
  21. * By default, the 404 response will be returned for an calls to undefined
  22. * methods on the controller. However, this method may also be overridden
  23. * and used as a pseudo-router by the controller.
  24. */
  25. public function __call($method, $parameters)
  26. {
  27. return $this->container->resolve('laravel.response')->error('404');
  28. }
  29. /**
  30. * Magic Method for retrieving items out of the IoC container.
  31. */
  32. public function __get($key)
  33. {
  34. return $this->container->$key;
  35. }
  36. }