/** * Returns whether there is user interaction available * * @return array */ public function isInteractive() { if (is_null($this->command)) { return false; } return !(bool) $this->command->option('auto'); }
/** * @return mixed */ public function seedAdminRole() { if ($this->command->option('verbose')) { return $this->command->call('db:seed', ['--class' => 'Modules\\User\\Database\\Seeders\\GroupSeedTableSeeder']); } return $this->command->callSilent('db:seed', ['--class' => 'Modules\\User\\Database\\Seeders\\GroupSeedTableSeeder']); }
/** * Handle the command. * * @param Filesystem $filesystem * @param Application $application * @return string */ public function handle(Filesystem $filesystem, Application $application) { $destination = $application->getResourcesPath('streams/lang'); if (is_dir($destination) && !$this->command->option('force')) { return $this->command->error("{$destination} already exists."); } $filesystem->copyDirectory(__DIR__ . '/../../../../resources/lang', $destination); $this->command->info("Published {$destination}"); }
/** * Handle the command. * * @param Filesystem $filesystem * @param Application $application * @return string */ public function handle(Filesystem $filesystem, Application $application) { $destination = $application->getResourcesPath('addons/' . $this->addon->getVendor() . '/' . $this->addon->getSlug() . '-' . $this->addon->getType() . '/views'); if (is_dir($destination) && !$this->command->option('force')) { $this->command->error("{$destination} already exists."); return; } $filesystem->copyDirectory($this->addon->getPath('resources/views'), $destination); $this->command->info("Published {$destination}"); }
/** * Fire the install script. * * @param Command $command * * @return mixed */ public function fire(Command $command) { if ($command->option('verbose')) { $command->blockMessage('Themes', 'Publishing theme assets ...', 'comment'); } if ($command->option('verbose')) { $command->call('stylist:publish'); return; } $command->callSilent('stylist:publish'); }
/** * Handle the command. * * @param Filesystem $filesystem * @param Application $application * @return string */ public function handle(Filesystem $filesystem, Application $application) { $shared = $this->command->option('shared') ? 'shared' : $application->getReference(); $path = base_path("addons/{$shared}/{$this->vendor}/{$this->slug}-{$this->type}"); $config = "{$path}/resources/config"; $views = "{$path}/resources/views"; $filesystem->makeDirectory($path, 0755, true, true); $filesystem->makeDirectory($views, 0755, true, true); $filesystem->makeDirectory($config, 0755, true, true); return $path; }
/** * Handle the command. * * @param Filesystem $filesystem * @param Application $application * @return string */ public function handle(Filesystem $filesystem, Application $application) { $destination = $application->getResourcesPath('.env'); if (!is_dir(dirname($destination))) { $filesystem->makeDirectory(dirname($destination), 0777, true, true); } if (is_file($destination) && !$this->command->option('force')) { return $this->command->error("{$destination} already exists."); } $filesystem->put($destination, '#EXAMPLE=foo'); $this->command->info("Published {$destination}"); }
/** * Fire the install script * @param Command $command * @return mixed */ public function fire(Command $command) { if ($command->option('verbose')) { $command->blockMessage('Seeds', 'Running the module seeds ...', 'comment'); } foreach ($this->modules as $module) { if ($command->option('verbose')) { $command->call('module:seed', ['module' => $module]); continue; } $command->callSilent('module:seed', ['module' => $module]); } }
/** * Handle the command. * * @param Filesystem $filesystem * @param Application $application * @return string */ public function handle(Filesystem $filesystem, Application $application) { $destination = $application->getResourcesPath('routes.php'); if (!is_dir(dirname($destination))) { $filesystem->makeDirectory(dirname($destination), 0777, true, true); } if (is_file($destination) && !$this->command->option('force')) { return $this->command->error("{$destination} already exists."); } $content = "<?php\n\n// Route::get('/', function () {\n// return view('welcome');\n// });\n"; $filesystem->put($destination, $content); $this->command->info("Published {$destination}"); }
/** * Fire the install script * @param Command $command * @return mixed */ public function fire(Command $command) { if ($command->option('verbose')) { $command->blockMessage('Module assets', 'Publishing module assets ...', 'comment'); } foreach ($this->modules as $module) { if ($command->option('verbose')) { $command->call('module:publish', ['module' => $module]); continue; } $command->callSilent('module:publish', ['module' => $module]); } }
/** * Fire the install script * @param Command $command * @return mixed */ public function fire(Command $command) { if ($command->option('verbose')) { $command->blockMessage('Migrations', 'Starting the module migrations ...', 'comment'); } foreach ($this->modules as $module) { if ($command->option('verbose')) { $command->call('module:migrate', ['module' => $module]); continue; } $command->callSilent('module:migrate', ['module' => $module]); } }
private function prepareOptions() { $options = ['fieldsFile', 'tableName', 'fromTable', 'save']; foreach ($options as $option) { $this->options[$option] = $this->commandObj->option($option); } if ($this->options['fromTable']) { if (!$this->options['tableName']) { $this->commandError('tableName required with fromTable option.'); exit; } } $this->options['softDelete'] = config('infyom.laravel_generator.options.softDelete', true); }
/** * Fire the install script. * * @param Command $command * * @throws Exception * * @return mixed */ public function fire(Command $command) { if (!$this->finder->isFile('.env')) { throw new Exception('SocietyCMS is not installed. Please run "php artisan society:install" first.'); } if ($command->option('refresh') && !App::environment('demo')) { throw new Exception('Refresh option is only available in demo mode.'); } if (!$command->option('force') && !$command->option('refresh')) { if (!$command->confirm('Are you sure you want to start Demo Mode?')) { throw new Exception('Demo Mode cancelled'); } } }
private function getMessage($route, $target_id, \Illuminate\Database\Eloquent\Model $user, \Illuminate\Console\Command $command) { $url = $route . '/' . $user->id . '/' . $target_id; $request = Request::create($url, 'GET'); Input::initialize([]); if ($command->option('verbose')) { $command->comment('route:' . $route); } $item = $this->router->dispatch($request)->getOriginalContent(); if ($item === null) { return; } $view = 'sms.' . $route; $message = view($view, ['item' => $item]); if (Config::get('sms-manager.prefix')) { $message = Config::get('sms-manager.prefix') . $message; } $adminPhone = Config::get('sms-manager.admin_phone'); $receiver_number = $adminPhone ? $adminPhone : $user->phone; $to = $user->name; // HACKHACK: Needs to update the database instead if ($receiver_number[0] != '6') { $receiver_number = '6' . $receiver_number; } return (object) ['to' => $to, 'receiver_number' => $receiver_number, 'message' => $message]; }
/** * Fire the install script. * * @param Command $command * * @return mixed */ public function fire(Command $command) { if ($command->option('verbose')) { $command->blockMessage('Seeds', 'Running the module seeds ...', 'comment'); } $this->demoSeedCoreModules($command); $this->demoSeedAdditionalModules($command); }
/** * Fire the install script * @param Command $command * @return mixed */ public function fire(Command $command) { if ($command->option('verbose')) { $command->call('key:generate'); return; } $command->callSilent('key:generate'); }
/** * Generate request classes. */ public function generateLangResources() { if (!$this->confirm('Do you want to create the language resource files?')) { return; } foreach ($this->getMainTables() as $table) { $this->console->call('generate:lang', ['name' => $this->getEntity($table), '--languages' => $this->console->option('languages'), '--translations' => $this->getLangTranslations($table), '--force' => $this->console->option('force')]); } }
/** * Generate request classes. */ public function generateRequest() { if (!$this->confirm('Do you want to create form request classes?')) { return; } foreach (['Create', 'Update'] as $request) { $name = $this->getPrefix('/') . $this->getEntities() . '/' . $request . Str::studly($this->getEntity()) . 'Request'; $this->console->call('generate:request', ['name' => $name, '--scaffold' => true, '--auth' => true, '--rules' => $this->console->option('fields'), '--force' => $this->console->option('force')]); } }
/** * Fire the install script. * * @param Command $command * * @throws Exception * * @return mixed */ public function fire(Command $command) { $this->command = $command; if ($command->option('verbose')) { $command->blockMessage('Requirements', 'Checking System Requirements ...', 'comment'); } $this->checkPHPVersion(); $this->checkExtensions(); $this->showResults(); }
/** * Handle the command. * * @param AddonCollection $addons */ public function handle(AddonCollection $addons) { foreach ($this->paths as $path) { $options = ['--path' => $path]; if ($this->command->option('force')) { $options['--force'] = true; } if ($this->command->option('pretend')) { $options['--pretend'] = true; } if ($this->command->option('seed')) { $options['--seed'] = true; } if ($database = $this->command->option('database')) { $options['--database'] = $database; } $this->command->call('migrate', $options); } return; }
/** * Handle the command. * * @param AddonCollection $addons */ public function handle(AddonCollection $addons) { foreach ($addons->enabled() as $addon) { $options = ['--addon' => $addon->getNamespace()]; if ($this->command->option('force')) { $options['--force'] = true; } if ($this->command->option('pretend')) { $options['--pretend'] = true; } if ($this->command->option('seed')) { $options['--seed'] = true; } if ($database = $this->command->option('database')) { $options['--database'] = $database; } $this->command->call('migrate', $options); } return; }
/** * Fire the install script * @param Command $command * @return mixed */ public function fire(Command $command) { $this->command = $command; // Publish asgard configs if ($this->command->option('verbose')) { $this->command->call('vendor:publish', ['--provider' => 'Modules\\Core\\Providers\\CoreServiceProvider']); } else { $this->command->callSilent('vendor:publish', ['--provider' => 'Modules\\Core\\Providers\\CoreServiceProvider']); } if (!$this->checkIsInstalled()) { return $this->command->error('No user driver was installed. Please check the presence of a Service Provider'); } $this->publish(); $this->configure(); $this->migrate(); $this->seed(); $this->createFirstUser(); if ($this->command->option('verbose')) { $command->info($this->driver . ' succesfully configured'); } }
/** * Get the path to the proper Braintree Spark service provider. * * @return string */ protected function getBraintreeSparkProvider() { return $this->command->option('team-billing') ? SPARK_STUB_PATH . '/app/Providers/SparkBraintreeTeamBillingServiceProvider.php' : SPARK_STUB_PATH . '/app/Providers/SparkBraintreeServiceProvider.php'; }
/** * Get the file name for the services configuration file. * * @return string */ protected function servicesFile() { return $this->command->option('braintree') ? 'services-braintree' : 'services-stripe'; }
/** * Fire the install script * @param Command $command * @return mixed * @throws Exception */ public function fire(Command $command) { if ($this->finder->isFile('.env') && !$command->option('force')) { throw new Exception('Asgard has already been installed. You can already log into your administration.'); } }
/** * Fire the install script. * * @param Command $command * * @throws Exception * * @return mixed */ public function fire(Command $command) { if ($this->finder->isFile('.env') && $this->finder->isFile(storage_path('app/installed')) && !$command->option('force')) { throw new Exception('SocietyCMS has already been installed. You can already log into your administration.'); } }
/** * Get the path to the proper User model stub. * * @return string */ protected function getUserModel() { return $this->command->option('team-billing') ? SPARK_STUB_PATH . '/app/TeamUser.php' : SPARK_STUB_PATH . '/app/User.php'; }
/** * Get the appropriate migration files. * * @return array */ protected function getMigrations() { return $this->command->option('braintree') ? $this->getBraintreeMigrations() : $this->getStripeMigrations(); }