Boot.php 1.1 KB

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