src/Console/Commands/Migrations/GenerateCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->bootstrap($input, $output);
        $tableName = $input->hasParameterOption('--table') !== false 
            ? $input->getOption('table') 
            : '';

        $path = $this->container['phpmig.migrations_path'];
        $locator = new FileLocator(array());
        $path    = $locator->locate($path, base_path(), $first = true);

        if (!is_writeable($path)) {
            throw new \InvalidArgumentException(sprintf(
                'The directory "%s" is not writeable',
                $path
            ));
        }

        $path = realpath($path);
        $migrationName = $this->transMigName($input->getArgument('name'));
        $basename  = date('YmdHis') . '_' . $migrationName . '.php';
        $path = $path . DIRECTORY_SEPARATOR . $basename;
        if (file_exists($path)) {
            throw new \InvalidArgumentException(sprintf('The file "%s" already exists', $path));
        }

        $className = $this->migrationToClassName($migrationName);
        $schema = '$this';
        $blueprint = '$table';
        $contents = <<<PHP
<?php

use Nur\Database\Migration\Migration;
use Illuminate\Database\Schema\Blueprint;

class $className extends Migration
{
    /* Do the migration */
    public function up()
    {
        {$schema}->schema->create('{$tableName}', function(Blueprint $blueprint) {
            {$blueprint}->increments('id');
            
            {$blueprint}->timestamps();
            {$blueprint}->enum('status', [0, 1]);
        });
    }

    /* Undo the migration */
    public function down()
    {
        {$schema}->schema->dropIfExists('{$tableName}');
    }
}

PHP;
        if (false === file_put_contents($path, $contents)) {
            throw new \RuntimeException(sprintf('The file "%s" could not be written to', $path));
        }

        $output->writeln(
            '<info>+Success!</info> ' .
            '"'.str_replace([getcwd(), 'database', 'migrations', '/', '\\', '.php'], '', $path).'" migration generated.'
        );

        return;
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->bootstrap($input, $output);
        $tableName = $input->hasParameterOption('--table') !== false 
            ? $input->getOption('table') 
            : '';

        $path = $this->container['phpmig.migrations_path'];
        $locator = new FileLocator(array());
        $path    = $locator->locate($path, base_path(), $first = true);

        if (!is_writeable($path)) {
            throw new \InvalidArgumentException(sprintf(
                'The directory "%s" is not writeable',
                $path
            ));
        }

        $path = realpath($path);
        $migrationName = $this->transMigName($input->getArgument('name'));
        $basename  = date('YmdHis') . '_' . $migrationName . '.php';
        $path = $path . DIRECTORY_SEPARATOR . $basename;
        if (file_exists($path)) {
            throw new \InvalidArgumentException(sprintf('The file "%s" already exists', $path));
        }

        $className = $this->migrationToClassName($migrationName);
        $schema = '$this';
        $blueprint = '$table';
        $contents = <<<PHP
<?php

use Nur\Database\Migration\Migration;
use Illuminate\Database\Schema\Blueprint;

class $className extends Migration
{
    /* Do the migration */
    public function up()
    {
        {$schema}->schema->create('{$tableName}', function(Blueprint $blueprint) {
            {$blueprint}->increments('id');
            
            {$blueprint}->timestamps();
            {$blueprint}->enum('status', [0, 1]);
        });
    }

    /* Undo the migration */
    public function down()
    {
        {$schema}->schema->dropIfExists('{$tableName}');
    }
}

PHP;
        if (false === file_put_contents($path, $contents)) {
            throw new \RuntimeException(sprintf('The file "%s" could not be written to', $path));
        }

        $output->writeln(
            '<info>+Success!</info> ' .
            '"'.str_replace([getcwd(), 'database', 'migrations', '/', '\\', '.php'], '', $path).'" migration generated.'
        );

        return;
    }
{@inheritdoc}