<?php
namespace Nwidart\Modules\Commands;
use Illuminate\Console\Command;
use Nwidart\Modules\Exceptions\FileAlreadyExistException;
use Nwidart\Modules\Generators\FileGenerator;
abstract class GeneratorCommand extends Command
{
protected $argumentName = '';
abstract protected function getTemplateContents();
abstract protected function getDestinationFilePath();
public function handle() : int
{
$path = str_replace('\\', '/', $this->getDestinationFilePath());
if (!$this->laravel['files']->isDirectory($dir = dirname($path))) {
$this->laravel['files']->makeDirectory($dir, 0777, true);
}
$contents = $this->getTemplateContents();
try {