本文整理汇总了PHP中Illuminate\Console\Command::confirm方法的典型用法代码示例。如果您正苦于以下问题:PHP Command::confirm方法的具体用法?PHP Command::confirm怎么用?PHP Command::confirm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Console\Command
的用法示例。
在下文中一共展示了Command::confirm方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the command.
*
* @param Markdown $markdown
*/
public function handle(Markdown $markdown)
{
$this->command->info(strip_tags($markdown->transform(file_get_contents(base_path('LICENSE.md')))));
if (!$this->command->confirm('Do you agree to the provided license and terms of service?')) {
$this->command->error('You must agree to the license and terms of service before continuing.');
exit;
}
}
示例2: check
public function check($release)
{
$this->command->line('Lastest version found is <info>' . $release . '</info>
Current version is <info>' . $this->getSparkVersion() . '</info>' . PHP_EOL);
if ($this->supported($release)) {
$this->command->line('Release ' . $release . ' is Hexavel compatible: <info>✔</info>');
return true;
}
$this->command->line('<error>Version ' . $release . ' is not yet considered Hexavel compatible</error>' . PHP_EOL);
$this->command->line('This <fg=red;options=bold;>might break your application</> but you can continue at your own risk. If you have not already, try updating Hexavel-Spark via \'composer update\'.');
if (!$this->command->confirm('Do you wish to still continue? [y|N]')) {
return false;
}
return true;
}
示例3: confirm
/**
* Confirm a question with the user.
*
* @param string $message
*
* @return string
*/
public function confirm($message)
{
if ($this->console->option('no-question')) {
return true;
}
return $this->console->confirm($message);
}
示例4: confirm
public function confirm($question, $default = false)
{
if ($this->option('no-input')) {
return true;
}
return parent::confirm($question, $default);
}
示例5: confirm
public function confirm($question, $default = true)
{
if ($this->option('yes')) {
return true;
}
return parent::confirm($question, $default);
}
示例6: afterRegistration
/**
* Called after the user has finished registering new services.
* @return void
*/
public function afterRegistration()
{
$register = $this->command->confirm('Would you like to register system hooks?', true);
if ($register) {
$hookRegister = new HookRegister($this->gitlabManager);
$hookRegister->registerSystemHooksOnInstances();
}
}
示例7: createFile
/**
* @param string $fileName
* @param string $fileContents
* @param bool $overwrite
*/
public function createFile($fileName, $fileContents, $overwrite = false)
{
if (\File::exists($fileName) && !$overwrite) {
$overwrite = $this->fromFile ? true : $this->command->confirm("{$fileName} already exists! Overwrite it? ", true);
if ($overwrite) {
\File::put($fileName, $fileContents);
}
} else {
\File::put($fileName, $fileContents);
}
}
示例8: fire
/**
* Fire the install script.
*
* @param Command $command
*
* @return mixed
*/
public function fire(Command $command)
{
$gitignorePath = base_path('.gitignore');
if (!$this->gitignoreContainsComposerLock($gitignorePath)) {
return;
}
$removeComposerLock = $command->confirm('Do you want to remove composer.lock from .gitignore ?', true);
if ($removeComposerLock) {
$out = $this->getGitignoreLinesButComposerLock($gitignorePath);
$this->writeNewGitignore($gitignorePath, $out);
}
}
示例9: renderCommandField
public function renderCommandField(Command $command)
{
while (true) {
$input = $command->confirm($this->getConsoleLabel());
$validator = $this->getValidator($input);
if ($validator->passes()) {
return $input;
} else {
$command->error($validator->errors()->first());
}
}
}
示例10: fire
/**
* 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');
}
}
}
示例11: generateLayoutFiles
public function generateLayoutFiles()
{
$makeLayout = $this->fromFile ? true : $this->command->confirm('Create default layout file [y/n]? (specify css/js files in config) ', true);
if ($makeLayout) {
$layoutPath = $this->configSettings['pathTo']['layout'];
$layoutDir = substr($layoutPath, 0, strrpos($layoutPath, "/"));
$next_to_last = strrpos($layoutPath, "/", strrpos($layoutPath, "/") - strlen($layoutPath) - 1) + 1;
$layoutName = str_replace("/", ".", substr($layoutPath, $next_to_last, strpos($layoutPath, ".") - $next_to_last));
$directoriesToCreate = array($layoutDir, 'public/js', 'public/css', 'public/img');
foreach ($directoriesToCreate as $dir) {
$this->fileCreator->createDirectory($dir);
}
$content = \File::get($this->configSettings['pathTo']['controllers'] . 'Controller.php');
if (strpos($content, "\$layout") === false) {
$content = preg_replace("/Controller {/", "Controller {\n\tprotected \$layout = '{$layoutName}';", $content);
\File::put($this->configSettings['pathTo']['controllers'] . 'Controller.php', $content);
}
$overwrite = false;
if (\File::exists($layoutPath)) {
$overwrite = $this->command->confirm('Layout file exists. Overwrite? [y/n]? ', true);
}
if (!\File::exists($layoutPath) || $overwrite) {
$this->fileContents = \File::get($this->configSettings['pathTo']['templates'] . 'layout.txt');
$this->fileContents = str_replace("<!--[appName]-->", $this->configSettings['appName'], $this->fileContents);
$this->downloadAsset("jquery", "http://code.jquery.com/jquery-1.11.0.min.js");
$this->downloadCSSFramework();
$this->downloadAsset("underscore", "http://underscorejs.org/underscore-min.js");
$this->downloadAsset("handlebars", "http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js");
$this->downloadAsset("angular", "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js");
$this->downloadAsset("ember", "http://builds.emberjs.com/tags/v1.5.0/ember.min.js");
$this->downloadAsset("backbone", "http://backbonejs.org/backbone-min.js");
\File::put($layoutPath, $this->fileContents);
} else {
$this->command->error('Layout file already exists!');
}
}
}
示例12: runMigrations
/**
* Prompt user to run the migrations
*/
private function runMigrations()
{
if (!$this->fromFile) {
$editMigrations = $this->command->confirm('Would you like to edit your migrations file before running it [y/n]? ', true);
if ($editMigrations) {
$this->command->info('Remember to run "php artisan migrate" after editing your migration file');
$this->command->info('And "php artisan db:seed" after editing your seed file');
} else {
while (true) {
try {
$this->command->call('migrate');
$this->command->call('db:seed');
break;
} catch (\Exception $e) {
$this->command->info('Error: ' . $e->getMessage());
$this->command->error('This table already exists and/or you have duplicate migration files.');
$this->command->confirm('Fix the error and enter "yes" ', true);
}
}
}
}
}
示例13: confirm
/**
* Confirm a question with the user.
*
* @param string $question
* @param bool $default
* @return bool
*/
public function confirm($question, $default = true)
{
$question .= $default ? ' [Yn]' : ' [yN]';
return parent::confirm($question, $default);
}