Nwidart\Modules\Commands\GeneratorCommand::fire PHP Method

fire() public method

Execute the console command.
public fire ( )
    public function fire()
    {
        $path = str_replace('\\', '/', $this->getDestinationFilePath());
        if (!$this->laravel['files']->isDirectory($dir = dirname($path))) {
            $this->laravel['files']->makeDirectory($dir, 0777, true);
        }
        $contents = $this->getTemplateContents();
        try {
            with(new FileGenerator($path, $contents))->generate();
            $this->info("Created : {$path}");
        } catch (FileAlreadyExistException $e) {
            $this->error("File : {$path} already exists.");
        }
    }

Usage Example

 public function fire()
 {
     if (!$this->option('event')) {
         return $this->error('The --event option is necessary');
     }
     parent::fire();
 }
All Usage Examples Of Nwidart\Modules\Commands\GeneratorCommand::fire