当前位置: 首页>>代码示例>>PHP>>正文


PHP Command::confirm方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:13,代码来源:ConfirmLicense.php

示例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;
 }
开发者ID:peterfox,项目名称:hexavel-spark,代码行数:15,代码来源:CheckCompatibility.php

示例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);
 }
开发者ID:dcodingti,项目名称:loteria,代码行数:14,代码来源:ScaffoldGenerator.php

示例4: confirm

 public function confirm($question, $default = false)
 {
     if ($this->option('no-input')) {
         return true;
     }
     return parent::confirm($question, $default);
 }
开发者ID:nayjest,项目名称:db-dump,代码行数:7,代码来源:DbDumpCommand.php

示例5: confirm

 public function confirm($question, $default = true)
 {
     if ($this->option('yes')) {
         return true;
     }
     return parent::confirm($question, $default);
 }
开发者ID:web6-agency,项目名称:six-cli,代码行数:7,代码来源:BaseCommand.php

示例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();
     }
 }
开发者ID:continuous-deployment,项目名称:pipes,代码行数:12,代码来源:GitLabRegistrar.php

示例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);
     }
 }
开发者ID:binondord,项目名称:l5scaffold,代码行数:16,代码来源:FileCreator.php

示例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);
     }
 }
开发者ID:SocietyCMS,项目名称:Core,代码行数:19,代码来源:UnignoreComposerLock.php

示例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());
         }
     }
 }
开发者ID:illuminate3,项目名称:larastaller,代码行数:12,代码来源:ConfirmationField.php

示例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');
         }
     }
 }
开发者ID:SocietyCMS,项目名称:Core,代码行数:23,代码来源:ProtectInstallation.php

示例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!');
         }
     }
 }
开发者ID:jrenton,项目名称:laravel-5-scaffold,代码行数:37,代码来源:AssetDownloader.php

示例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);
                 }
             }
         }
     }
 }
开发者ID:tisstech,项目名称:bootstrap-laravel-scaffold,代码行数:25,代码来源:Scaffold.php

示例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);
 }
开发者ID:diemer,项目名称:eecli,代码行数:12,代码来源:GenerateAddonCommand.php


注:本文中的Illuminate\Console\Command::confirm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。