protected function tearDown()
 {
     Schema::drop('testing_table');
     $this->kernel->call('migrate:rollback');
     $this->app->flush();
     $this->app = null;
     parent::tearDown();
 }
 /**
  * Execute the job.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @param  \Illuminate\Contracts\Console\Kernel  $kernel
  *
  * @return void
  */
 public function handle(Application $app, Kernel $kernel)
 {
     if (!$app->routesAreCached()) {
         return;
     }
     $app->terminating(function () use($kernel) {
         $kernel->call('route:cache');
     });
 }
Example #3
0
 /**
  * Get all commands that are scheduled
  *
  * @return \Indatus\Dispatcher\Scheduling\ScheduledCommandInterface[]
  */
 public function getScheduledCommands()
 {
     $scheduledCommands = [];
     foreach ($this->console->all() as $command) {
         if ($command instanceof ScheduledCommandInterface) {
             $scheduledCommands[] = $command;
         }
     }
     return $scheduledCommands;
 }
 /**
  * Handle the command.
  *
  * @param Kernel     $console
  * @param Dispatcher $events
  */
 public function handle(Kernel $console, Dispatcher $events, ModuleRepositoryInterface $modules)
 {
     $this->module->fire('uninstalling');
     $options = ['--addon' => $this->module->getNamespace()];
     $console->call('migrate:reset', $options);
     $console->call('streams:destroy', ['namespace' => $this->module->getSlug()]);
     $console->call('streams:cleanup');
     $modules->uninstall($this->module);
     $this->module->fire('uninstalled');
     $events->fire(new ModuleWasUninstalled($this->module));
 }
 protected function createInMemoryDatabase()
 {
     $defaultConnection = $this->app['config']->get('database.default');
     $this->app['config']->set('database.connections.' . self::CONNECTION_NAME, ['driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '']);
     // Makes sure the migrations table is created
     $this->artisan->call('migrate', ['--database' => self::CONNECTION_NAME]);
     // We empty all tables
     $this->artisan->call('migrate:reset');
     // Migrate
     $this->artisan->call('migrate', ['--database' => self::CONNECTION_NAME]);
     $this->app['config']->set('database.default', $defaultConnection);
 }
 /**
  * Handle the command.
  *
  * @param  Kernel                       $console
  * @param  Dispatcher                   $events
  * @param  ExtensionRepositoryInterface $extensions
  * @return bool
  */
 public function handle(Kernel $console, Dispatcher $events, ExtensionRepositoryInterface $extensions)
 {
     $this->extension->fire('uninstalling');
     $options = ['--addon' => $this->extension->getNamespace()];
     $console->call('migrate:reset', $options);
     $console->call('streams:destroy', ['namespace' => $this->extension->getSlug()]);
     $console->call('streams:cleanup');
     $extensions->uninstall($this->extension);
     $this->extension->fire('uninstalled');
     $events->fire(new ExtensionWasUninstalled($this->extension));
     return true;
 }
Example #7
0
 /**
  * handle.
  *
  * @throws \InvalidArgumentException
  */
 public function fire()
 {
     $command = $this->option('command');
     if ($this->needForce($command) === true) {
         $command .= ' --force';
     }
     $input = new StringInput($command);
     $input->setInteractive(false);
     if (isset($this->notSupport[$input->getFirstArgument()]) === true) {
         throw new InvalidArgumentException('Command "' . $command . '" is not supported');
     }
     $this->artisan->handle($input, $this->getOutput());
 }
 /**
  * Handle the command.
  *
  * @param  InstallExtension|Kernel      $console
  * @param  AddonManager                 $manager
  * @param  Dispatcher                   $dispatcher
  * @param  ExtensionRepositoryInterface $extensions
  * @return bool
  */
 public function handle(Kernel $console, AddonManager $manager, Dispatcher $dispatcher, ExtensionRepositoryInterface $extensions)
 {
     $this->extension->fire('installing');
     $options = ['--addon' => $this->extension->getNamespace(), '--force' => true];
     $console->call('migrate:refresh', $options);
     $extensions->install($this->extension);
     $manager->register();
     if ($this->seed) {
         $console->call('db:seed', $options);
     }
     $this->extension->fire('installed');
     $dispatcher->fire(new ExtensionWasInstalled($this->extension));
     return true;
 }
Example #9
0
 /**
  *
  */
 public function scaffold()
 {
     if ($this->finder->isDirectory($this->getModulesPath())) {
         throw new ModuleExistsException();
     }
     $this->artisan->call("module:make", ['name' => [$this->name]]);
     $this->addDataToComposerFile();
     $this->removeUnneededFiles();
     $this->addFolders();
     $this->filesGenerator->forModule($this->name)->generateModuleProvider()->generate($this->files);
     $this->cleanUpModuleJson();
     $this->entityGenerator->forModule($this->name)->type($this->entityType)->generate($this->entities);
     $this->valueObjectGenerator->forModule($this->name)->type($this->entityType)->generate($this->valueObjects);
 }
 public function handle()
 {
     $this->info('Installing the Chargebee package');
     $bar = $this->output->createProgressBar(2);
     try {
         $this->console->call('vendor:publish', ['--provider' => ChargebeeServiceProvider::class]);
         $bar->advance();
         $this->console->call('migrate');
         $bar->advance();
     } catch (\Exception $e) {
         $this->error('Could not fully install the Chargebee package');
     }
     $bar->finish();
     $this->info(PHP_EOL . 'The Chargebee package was successfully installed');
 }
Example #11
0
 /**
  * Execute the console command.
  *
  * @param  \Illuminate\Contracts\Console\Kernel  $kernel
  *
  * @return void
  */
 public function handle(Kernel $kernel)
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $driver = $this->argument('driver');
     $action = $this->argument('action');
     $database = $this->option('database');
     if (!in_array($action, $this->actions)) {
         throw new InvalidArgumentException("Action [{$action}] is not available for this command.");
     }
     $command = "tenanti:{$action}";
     $parameters = ['driver' => $driver, '--database' => $database, '--force' => true];
     $migrator = $this->tenant->driver($driver);
     $migrator->executeByChunk(function ($entities) use($kernel, $command, $parameters) {
         foreach ($entities as $entity) {
             $parameters['--id'] = $entity->getKey();
             $kernel->queue($command, $parameters);
         }
     });
 }
Example #12
0
 /**
  * Execute the job.
  *
  * @param \Illuminate\Contracts\Console\Kernel $artisan
  */
 public function handle(Artisan $artisan)
 {
     $artisan->call('flashtag:subsplit');
 }
Example #13
0
 /**
  * @param array $args
  * @return mixed
  */
 public function rollback($args = [])
 {
     return $this->artisan->call('migrate:rollback', $args);
 }
Example #14
0
 private function seed($arguemnts)
 {
     $this->artisan->call('db:seed', $arguemnts);
 }
 /**
  * Seed a module.
  *
  * @param ModuleCollection $modules
  * @param ModuleManager    $manager
  * @param                  $module
  */
 public function seed(ModuleCollection $modules, Kernel $console, $module)
 {
     set_time_limit(5000);
     $module = $modules->get($module);
     $console->call('db:seed', ['--force' => true, '--addon' => $module->getNamespace()]);
     return response()->json(true);
 }
Example #16
0
 private function migrate($arguemnts)
 {
     $this->artisan->call('migrate', $arguemnts);
 }