Evercode1\ViewMaker\MakeParentAndChild::handle PHP Method

handle() public method

Execute the console command.
public handle ( ) : mixed
return mixed
    public function handle()
    {
        // Do Once for Parent, and Once for child
        // setup for crud
        $this->modelName = $this->formatModel($this->argument('ParentName'));
        $this->slug = $this->argument('Slug');
        $this->setCrudTokens();
        // add tokens for parent and child the crudTokens array
        $this->setParentChildTokens();
        $this->setFilePaths();
        // setup for views
        $this->setParentConfigFromInputs();
        // runs all commands
        if ($this->makeCrudFiles() && $this->makeViewDirectory()->makeViewFiles($this->templateType)) {
            $this->sendSuccessMessage('parent');
        } else {
            $this->error('Oops, something went wrong!');
            return;
        }
        // reset model to child
        $this->modelName = $this->formatModel($this->argument('ChildName'));
        $this->setCrudTokens();
        // add tokens for parent and child the crudTokens array
        $this->setParentChildTokens();
        $this->setFilePaths();
        // setup for views
        $this->setChildConfigFromInputs();
        // runs all commands
        if ($this->makeCrudFiles() && $this->makeViewDirectory()->makeViewFiles($this->templateType)) {
            $this->sendSuccessMessage('child');
            return;
        } else {
            $this->error('Oops, something went wrong!');
            return;
        }
    }