public function generate($model)
    {
        $create_at = date("YmdHis");
        $filename = sprintf("Version%s%s", $create_at, ucfirst(Str::camel($model)));

        $generator = new Generator(
            $this->setting->getMigrationDirectory(),
            $filename
        );

        $options = $this->arg->options();

        if ($options->has('--create') && $options->has('--table')) {
            $this->throwFailsCommand('bad command', 'add help');
        }

        $type = "model/standard";

        if ($options->has('--table')) {
            if ($options->get('--table') === true) {
                $this->throwFailsCommand('bad command option [--table=table]', 'add help');
            }

            $table = $options->get('--table');

            $type = 'model/table';
        } elseif ($options->has('--create')) {
            if ($options->get('--create') === true) {
                $this->throwFailsCommand('bad command option [--create=table]', 'add help');
            }

            $table = $options->get('--create');

            $type = 'model/create';
        }

        $generator->write($type, [
            'table' => $table ?? 'table_name',
            'className' => $filename
        ]);
        
        // Print console information
        echo Color::green('The migration file has been successfully created')."\n";
    }
public function generate($model)
    {
        $create_at = date("YmdHis");
        $filename = sprintf("Version%s%s", $create_at, ucfirst(Str::camel($model)));

        $generator = new Generator(
            $this->setting->getMigrationDirectory(),
            $filename
        );

        $options = $this->arg->options();

        if ($options->has('--create') && $options->has('--table')) {
            $this->throwFailsCommand('bad command', 'add help');
        }

        $type = "model/standard";

        if ($options->has('--table')) {
            if ($options->get('--table') === true) {
                $this->throwFailsCommand('bad command option [--table=table]', 'add help');
            }

            $table = $options->get('--table');

            $type = 'model/table';
        } elseif ($options->has('--create')) {
            if ($options->get('--create') === true) {
                $this->throwFailsCommand('bad command option [--create=table]', 'add help');
            }

            $table = $options->get('--create');

            $type = 'model/create';
        }

        $generator->write($type, [
            'table' => $table ?? 'table_name',
            'className' => $filename
        ]);
        
        // Print console information
        echo Color::green('The migration file has been successfully created')."\n";
    }
public function generate ( $ model ) { $ create_at = date ( "YmdHis" ) ; $ filename = sprintf ( "Version%s%s" , $ create_at , ucfirst ( Str :: camel ( $ model ) ) ) ; $ generator = new Generator ( $ this -> setting -> getMigrationDirectory ( ) , $ filename ) ; $ options = $ this -> arg -> options ( ) ; if ( $ options -> has ( '--create' ) && $ options -> has ( '--table' ) ) { $ this -> throwFailsCommand ( 'bad command' , 'add help' ) ; } $ type = "model/standard" ; if ( $ options -> has ( '--table' ) ) { if ( $ options -> get ( '--table' ) === true ) { $ this -> throwFailsCommand ( 'bad command option [--table=table]' , 'add help' ) ; } $ table = $ options -> get ( '--table' ) ; $ type = 'model/table' ; } elseif ( $ options -> has ( '--create' ) ) { if ( $ options -> get ( '--create' ) === true ) { $ this -> throwFailsCommand ( 'bad command option [--create=table]' , 'add help' ) ; } $ table = $ options -> get ( '--create' ) ; $ type = 'model/create' ; } $ generator -> write ( $ type , [ 'table' => $ table ?? 'table_name' , 'className' => $ filename ] ) ; // Print console information echo Color :: green ( 'The migration file has been successfully created' ) . "\n" ; }
Create a migration command

@param string $model

@return void
@throws \ErrorException
Create a migration command