safeLoad(); } public static function setDebug() { // debug if (Config::get('debug') == "true") { define("DEBUG", true); } } public static function setTimezone() { // config time zone date_default_timezone_set(Config::get('timeZone')); } public static function bootDb() { // Init Eloquent ORM Connection $capsule = new Capsule; $capsule->addConnection(Config::getDbConfig(), 'default'); if (Config::get('enable_log')=='true') { $capsule->addConnection(Config::getLogDbConfig(), 'log'); } // Several database-only coordinators intentionally use Capsule's // static query builder so every write in one workflow shares the // connection selected by the surrounding transaction. Eloquent's // resolver alone does not initialize that static Capsule instance. $capsule->setAsGlobal(); $capsule->bootEloquent(); self::bootPaginator(); } private static function bootPaginator() { $factoryResolver = function () { return new PaginationViewFactory(); }; Paginator::viewFactoryResolver($factoryResolver); LengthAwarePaginator::viewFactoryResolver($factoryResolver); $pathResolver = function () { $uri = isset($_SERVER['REQUEST_URI']) ? (string) $_SERVER['REQUEST_URI'] : '/'; $path = parse_url($uri, PHP_URL_PATH); return $path === null || $path === false || $path === '' ? '/' : $path; }; Paginator::currentPathResolver($pathResolver); LengthAwarePaginator::currentPathResolver($pathResolver); } }