/**
  * 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('');
 }
Exemple #2
0
<?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());
});
<?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');