mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-02-05 14:20:08 +08:00
set default timezone when boot up
This commit is contained in:
parent
6dbcc7aacd
commit
46bf958215
@ -11,7 +11,32 @@ class Application
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Boot::start();
|
||||
// Load Aliases
|
||||
Boot::loadServices();
|
||||
|
||||
// Check Runtime Environment
|
||||
Boot::checkRuntimeEnv();
|
||||
|
||||
// Set Default Timezone to UTC+8
|
||||
Boot::setTimeZone();
|
||||
|
||||
// Load dotenv Configuration
|
||||
Boot::loadDotEnv(BASE_DIR);
|
||||
|
||||
// Register Error Handler
|
||||
Boot::registerErrorHandler();
|
||||
|
||||
// Boot Eloquent ORM
|
||||
Boot::bootEloquent(Config::getDbConfig());
|
||||
|
||||
// Redirect if not installed
|
||||
Boot::checkInstallation();
|
||||
|
||||
// Start Session
|
||||
Boot::startSession();
|
||||
|
||||
// Start Route Dispatching
|
||||
Boot::bootRouter();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,33 +9,6 @@ use App\Exceptions\E;
|
||||
|
||||
class Boot
|
||||
{
|
||||
public static function start()
|
||||
{
|
||||
// Load Aliases
|
||||
self::loadServices();
|
||||
|
||||
// Check Runtime Environment
|
||||
self::checkRuntimeEnv();
|
||||
|
||||
// Load dotenv Configuration
|
||||
self::loadDotEnv(BASE_DIR);
|
||||
|
||||
// Register Error Handler
|
||||
self::registerErrorHandler();
|
||||
|
||||
// Boot Eloquent ORM
|
||||
self::bootEloquent(Config::getDbConfig());
|
||||
|
||||
// Redirect if not installed
|
||||
self::checkInstallation();
|
||||
|
||||
// Start Session
|
||||
self::startSession();
|
||||
|
||||
// Start Route Dispatching
|
||||
self::bootRouter();
|
||||
}
|
||||
|
||||
public static function loadDotEnv($dir)
|
||||
{
|
||||
if (Config::checkDotEnvExist()) {
|
||||
@ -44,6 +17,12 @@ class Boot
|
||||
}
|
||||
}
|
||||
|
||||
public static function setTimeZone($timezone = 'Asia/Shanghai')
|
||||
{
|
||||
// set default time zone, UTC+8 for default
|
||||
date_default_timezone_set($timezone);
|
||||
}
|
||||
|
||||
public static function checkRuntimeEnv()
|
||||
{
|
||||
Config::checkPHPVersion();
|
||||
|
@ -44,8 +44,6 @@ class Utils
|
||||
|
||||
public static function getTimeFormatted($timestamp = 0)
|
||||
{
|
||||
// set default time zone to UTC+8
|
||||
date_default_timezone_set('Asia/Shanghai');
|
||||
return ($timestamp == 0) ? date('Y-m-d H:i:s') : date('Y-m-d H:i:s', $timestamp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user