/** * Init Core * * @uses Stativo\Helpers\Language * @uses Stativo\Helpers\File * @return \Core Returns instance of Stativo\Core\Core */ public function init() { // Load env files $dotenv = new \Dotenv\Dotenv(DOCROOT, '.env'); $dotenv->overload(); // Load config (after \Dotenv) $config = self::config('app'); // Init DB if is set true if ($config->get('database')['enabled']) { $capsule = new \Illuminate\Database\Capsule\Manager(); foreach ($config->get('database')['connections'] as $name => $conn) { $capsule->addConnection($conn, $name); } $capsule->setAsGlobal(); $capsule->bootEloquent(); } // Init translation if set true if ($config->get('language')['enabled']) { \Stativo\Helpers\Language::instance(); } if (class_exists(\Stativo\Helpers\File::class)) { \Stativo\Helpers\File::instance(); } return $this; }
/** * Get translation * @param string $key key to translate * @param array $variables optional values to replace * @return string */ function trans($key = null, $variables = null) { return \Stativo\Helpers\Language::instance()->translate($key, $variables); }