本文整理匯總了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('');
}
示例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());
});
示例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');