clearBootedModels() public static method

Clear the list of booted models so they will be re-booted.
public static clearBootedModels ( ) : void
return void
 /**
  * @param $resolver
  */
 protected function bootModels($resolver)
 {
     Model::clearBootedModels();
     Model::setEventDispatcher($this->app['illuminate.events']);
     Model::setConnectionResolver($resolver);
     $this->app['dispatcher']->dispatch(NineEvents::MODELS_BOOTED, new EloquentEvent($this->container->get('db')));
 }
Example #2
0
 protected function registerDatabase()
 {
     Model::clearBootedModels();
     $this->app->singleton('db.factory', function ($app) {
         return new ConnectionFactory($app);
     });
     $this->app->singleton('db', function ($app) {
         return new DatabaseManager($app, $app['db.factory']);
     });
     $this->app->alias('db', DatabaseManager::class);
     $this->app->bind('Illuminate\\Database\\ConnectionResolverInterface', DatabaseManager::class);
 }
 protected function registerDatabase()
 {
     Model::clearBootedModels();
     $this->app->singleton('db.factory', function ($app) {
         return new ConnectionFactory($app);
     });
     $this->app->singleton('db', function ($app) {
         return new DatabaseManager($app, $app['db.factory']);
     });
     $this->app->bind('db.connection', function ($app) {
         return $app['db']->connection();
     });
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     Model::clearBootedModels();
     $this->registerEloquentFactory();
     $this->registerQueueableEntityResolver();
     // The connection factory is used to create the actual connection instances on
     // the database. We will inject the factory into the manager so that it may
     // make the connections while they are actually needed and not of before.
     $this->app->singleton('db.factory', function ($app) {
         return new ConnectionFactory($app);
     });
     // The database manager is used to resolve various connections, since multiple
     // connections might be managed. It also implements the connection resolver
     // interface which may be used by other components requiring connections.
     $this->app->singleton('db', function ($app) {
         return new DatabaseManager($app, $app['db.factory']);
     });
 }