當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。