facades.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php namespace Laravel\Facades;
  2. use Laravel\IoC;
  3. abstract class Facade {
  4. /**
  5. * Magic Method for passing methods to a class registered in the IoC container.
  6. * This provides a convenient method of accessing functions on classes that
  7. * could not otherwise be accessed staticly.
  8. *
  9. * Facades allow Laravel to still have a high level of dependency injection
  10. * and testability while still accomodating the common desire to conveniently
  11. * use classes via static methods.
  12. */
  13. public static function __callStatic($method, $parameters)
  14. {
  15. return call_user_func_array(array(IoC::container()->resolve(static::$resolve), $method), $parameters);
  16. }
  17. }
  18. class Asset extends Facade { public static $resolve = 'laravel.asset'; }
  19. class Auth extends Facade { public static $resolve = 'laravel.auth'; }
  20. class Cache extends Facade { public static $resolve = 'laravel.cache'; }
  21. class Config extends Facade { public static $resolve = 'laravel.config'; }
  22. class Cookie extends Facade { public static $resolve = 'laravel.cookie'; }
  23. class Crypter extends Facade { public static $resolve = 'laravel.crypter'; }
  24. class DB extends Facade { public static $resolve = 'laravel.database'; }
  25. class Download extends Facade { public static $resolve = 'laravel.download'; }
  26. class File extends Facade { public static $resolve = 'laravel.file'; }
  27. class Form extends Facade { public static $resolve = 'laravel.form'; }
  28. class Hasher extends Facade { public static $resolve = 'laravel.hasher'; }
  29. class HTML extends Facade { public static $resolve = 'laravel.html'; }
  30. class Input extends Facade { public static $resolve = 'laravel.input'; }
  31. class Lang extends Facade { public static $resolve = 'laravel.lang'; }
  32. class Loader extends Facade { public static $resolve = 'laravel.loader'; }
  33. class Package extends Facade { public static $resolve = 'laravel.package'; }
  34. class Redirect extends Facade { public static $resolve = 'laravel.redirect'; }
  35. class Request extends Facade { public static $resolve = 'laravel.request'; }
  36. class Response extends Facade { public static $resolve = 'laravel.response'; }
  37. class Session extends Facade { public static $resolve = 'laravel.session'; }
  38. class URL extends Facade { public static $resolve = 'laravel.url'; }
  39. class Validator extends Facade { public static $resolve = 'laravel.validator'; }
  40. class View extends Facade { public static $resolve = 'laravel.view'; }