本文整理汇总了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');