當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Artisan::command方法代碼示例

本文整理匯總了PHP中Artisan::command方法的典型用法代碼示例。如果您正苦於以下問題:PHP Artisan::command方法的具體用法?PHP Artisan::command怎麽用?PHP Artisan::command使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Artisan的用法示例。


在下文中一共展示了Artisan::command方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     //  move the revision table
     if (!file_exists(database_path('migrations/2013_04_09_062329_create_revisions_table.php')) && ($fs = fopen(database_path('migrations/2013_04_09_062329_create_revisions_table.php'), 'x'))) {
         fwrite($fs, file_get_contents(base_path('vendor/venturecraft/revisionable/src/migrations/2013_04_09_062329_create_revisions_table.php')));
         fclose($fs);
     }
     //  make a notifications migration if not already created
     if (!\Illuminate\Support\Facades\Schema::hasTable('notifications')) {
         \Artisan::command('notifications:table');
     }
     $this->laravel->view->addNamespace('laraboard', substr(__DIR__, 0, -8) . 'migrations');
     $postsTable = 'posts';
     $subscriptionsTable = 'subscriptions';
     $alertsTable = 'alerts';
     $this->line('');
     $this->info("Tables: {$postsTable}, {$subscriptionsTable}, {$alertsTable}");
     $message = $this->generateMigrationMessage([$postsTable, $subscriptionsTable, $alertsTable]);
     $this->comment($message);
     $existingMigrations = $this->alreadyExistingMigrations();
     if ($existingMigrations) {
         $this->line('');
         $this->warn($this->getExistingMigrationsWarning($existingMigrations));
     }
     $this->line('');
     if (!$this->confirm("Proceed with the migration creation?", "yes")) {
         return;
     }
     $this->line('');
     $this->info("Creating migration...");
     if ($this->createMigration()) {
         $this->info("Migration successfully created!");
     } else {
         $this->error("Couldn't create migration.\n" . "Check the write permissions within the database/migrations directory.");
     }
     $this->line('');
 }
開發者ID:christhompsontldr,項目名稱:laraboard,代碼行數:42,代碼來源:MigrationsCommand.php

示例2: function

<?php

use Illuminate\Foundation\Inspiring;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
    $this->comment(Inspiring::quote());
});
開發者ID:nerea91,項目名稱:laravel,代碼行數:16,代碼來源:console.php

示例3: function

<?php

use Illuminate\Foundation\Inspiring;
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
    $this->comment(Inspiring::quote());
})->describe('Display an inspiring quote');
開發者ID:Dreamerpro,項目名稱:thinkmerit.api,代碼行數:16,代碼來源:console.php


注:本文中的Artisan::command方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。