Boot.php 941 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Services;
  3. use Dotenv\Dotenv;
  4. use Illuminate\Database\Capsule\Manager as Capsule;
  5. // @codeCoverageIgnoreStart
  6. class Boot
  7. {
  8. public static function loadEnv()
  9. {
  10. // Env
  11. $env = new Dotenv(BASE_PATH);
  12. $env->load();
  13. }
  14. public static function setDebug()
  15. {
  16. // debug
  17. if (Config::get('debug') == "true") {
  18. define("DEBUG", true);
  19. }
  20. }
  21. public static function setVersion($version)
  22. {
  23. $_ENV['version'] = $version;
  24. putenv("version=$version");
  25. }
  26. public static function setTimezone()
  27. {
  28. // config time zone
  29. date_default_timezone_set(Config::get('timeZone'));
  30. }
  31. public static function bootDb()
  32. {
  33. // Init Eloquent ORM Connection
  34. $capsule = new Capsule;
  35. $capsule->addConnection(Config::getDbConfig());
  36. $capsule->bootEloquent();
  37. }
  38. }
  39. // @codeCoverageIgnoreEnd