Mojopollo\Schema\Commands\MakeMigrationJsonCommand::fire PHP Method

fire() public method

Execute the console command.
public fire ( ) : mixed
return mixed
    public function fire()
    {
        // If json file is specified
        if ($this->filePath = $this->option('file')) {
            // Set file path directory
            $this->filePathDirectory = dirname($this->filePath);
            // Set undo file path
            $this->undoFilePath = $this->filePath . '.undo.json';
            // If the undo option was invoked
            if ($this->option('undo')) {
                // Undo previous file generation
                $this->undo();
                // End method execution
                return;
            }
            // If the validate option was invoked
            if ($this->option('validate')) {
                // Validate the json file
                $this->validate();
                // End method execution
                return;
            }
            // Generate the migrations
            $this->makeJsonMigration();
            // If disableundo is not active
            if ($this->option('disableundo') === false) {
                // Create a undo file
                $this->createUndoFile();
            }
        }
        // If no action options where chosen
        if ($this->filePath === null && $this->option('undo') === false && $this->option('validate') === false) {
            // Show help screen
            $this->call('help', ['command_name' => $this->name]);
        }
    }