示例#1
0
 /**
  * Build console entry point
  * @param array|null $services
  * @throws \Ffcms\Core\Exception\NativeException
  */
 public static function init(array $services = null)
 {
     self::$Properties = new Properties();
     self::$Input = new Input();
     self::$Output = new Output();
     // establish database link
     if (Obj::isArray(self::$Properties->get('database')) && (isset($services['Database']) && $services['Database'] === true || $services === null)) {
         self::$Database = new Capsule();
         self::$Database->addConnection(self::$Properties->get('database'));
         // Make this Capsule instance available globally via static methods... (optional)
         self::$Database->setAsGlobal();
         // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
         self::$Database->bootEloquent();
     }
 }