/**
  * {@inheritDoc}
  */
 public function boot()
 {
     $app = $this->app;
     // We told a little lie in the configuration. Extensions are actually
     // auto-registered upon booting of the Extensions Service Provider as
     // we had no access to configuration
     if ($app['config']->get('cartalyst.extensions.auto_register')) {
         Extension::setConnectionResolver($app['db']);
         Extension::setEventDispatcher($app['events']);
         Extension::setMigrator($app['migrator']);
         $app['extensions']->findAndRegisterExtensions();
         $app['extensions']->sortExtensions();
         // Now we will check if the extensions should be auto-booted.
         if ($app['config']->get('cartalyst.extensions.auto_boot')) {
             foreach ($app['extensions'] as $extension) {
                 $extension->setupDatabase();
             }
             foreach ($app['extensions']->allEnabled() as $extension) {
                 $extension->boot();
             }
         }
     }
 }
Example #2
0
 /**
  * Sets up the extensions environment for Platform.
  *
  * @return void
  */
 public function setupExtensions()
 {
     Extension::setMigrator($this->app['migrator']);
     Extension::setConnectionResolver($this->app['db']);
     Extension::setEventDispatcher($this->app['events']);
     $this->extensionBag->findAndRegisterExtensions();
     $this->extensionBag->sortExtensions();
 }
Example #3
0
 /**
  * Installs all the available extensions.
  *
  * @return void
  */
 protected function installExtensions()
 {
     // Alright, database connection established. Let's now grab all
     // core extensions
     $extensionBag = $this->laravel['platform']->getExtensionBag();
     // Register all local extension
     $extensionBag->findAndRegisterExtensions();
     // Sort the extensions by their dependencies
     $extensionBag->sortExtensions();
     // Set the connection resolver on our extensions
     Extension::setConnectionResolver($this->laravel['db']);
     // Set the laravel migrator on our extensions
     Extension::setMigrator($this->laravel['migrator']);
     // Flush the Cache
     $this->laravel['cache']->flush();
     // Loop through extensions
     foreach ($extensionBag->all() as $extension) {
         $extension->install();
         $extension->enable();
     }
 }