Barryvdh\LaravelIdeHelper\Console\ModelsCommand::fire PHP Method

fire() public method

Execute the console command.
public fire ( ) : void
return void
    public function fire()
    {
        $filename = $this->option('filename');
        $this->write = $this->option('write');
        $this->dirs = array_merge($this->laravel['config']->get('ide-helper.model_locations'), $this->option('dir'));
        $model = $this->argument('model');
        $ignore = $this->option('ignore');
        $this->reset = $this->option('reset');
        //If filename is default and Write is not specified, ask what to do
        if (!$this->write && $filename === $this->filename && !$this->option('nowrite')) {
            if ($this->confirm("Do you want to overwrite the existing model files? Choose no to write to {$filename} instead? (Yes/No): ")) {
                $this->write = true;
            }
        }
        $content = $this->generateDocs($model, $ignore);
        if (!$this->write) {
            $written = $this->files->put($filename, $content);
            if ($written !== false) {
                $this->info("Model information was written to {$filename}");
            } else {
                $this->error("Failed to write model information to {$filename}");
            }
        }
    }