It Replaces fieldUpload in the given stub.

@param string $stub
@param array $fields

@return $this
327746
protected function replaceFileUpload(&$stub, array $fields)
    {
        $code = $this->containsfile($fields) ? $this->getFileUploadAttribute($this->getTemplateName()) : '';

        return $this->replaceTemplate('upload_files', $code, $stub);
    }
356329
protected function buildFillable(&$stub)
    {
        $schemaArray = [];

        $schema = $this->scaffoldCommandObj->getMeta()['schema'];

        if ($schema)
        {
            $items = (new SchemaParser)->parse($schema);
            foreach($items as $item)
            {
                $schemaArray[] = "'{$item['name']}'";
            }

            $schemaArray = join(", ", $schemaArray);
        }

        $stub = str_replace('{{fillable}}', $schemaArray, $stub);

        return $this;
    }
737278
protected function replaceNamespace(&$stub)
    {
        $rootNamespace = App::getNamespace();

        $module = Module::get($this->getIdentifierInput());

        $baseNamespace = $module['namespace'];

        $namespace = $baseNamespace . "Http\Controllers";

        $stub = str_replace(
            ['DummyClass', 'DummyRootNamespace', 'DummyNamespace'],
            [$this->getNameInput(), $rootNamespace, $namespace],
            $stub
        );

        return $this;
    }
210326
protected function replaceName(&$stub)
    {
        $stub = str_replace('{{Class}}', $this->scaffoldCommandObj->getObjName('Names'), $stub);
        $stub = str_replace('{{class}}', $this->scaffoldCommandObj->getObjName('names'), $stub);
        $stub = str_replace('{{classSingle}}', $this->scaffoldCommandObj->getObjName('name'), $stub);
        $stub = str_replace('{{ClassSingle}}', $this->scaffoldCommandObj->getObjName('Name'), $stub);

        return $this;
    }
675990
protected function replaceNamespace($stub)
    {
        $stub = str_replace('DummyNamespace', $this->getNamespace(), $stub);
        $stub = str_replace('DummyRootNamespace', trim($this->laravel->getNamespace(), '\\'), $stub);

        return $stub;
    }
605399
protected function replaceNamespace(&$stub)
    {
        $stub = str_replace(
            ['DummyVendor', 'DummyName', 'DummyLowerVendor', 'DummyLowerName'],
            [$this->getVendorInput(), $this->getNameInput(), strtolower($this->getVendorInput()), strtolower($this->getNameInput())],
            $stub
        );

        return $this;
    }
553390
public function fields($fields)
    {
        $fields = is_array($fields) && func_num_args() === 1 ? $fields : func_get_args();
        $this->_parts['fields'] = Set::merge($this->_parts['fields'], $fields);
        return $this;
    }
484049
public function fields($fields)
    {
        if (is_array($fields) || $fields === null) {
            $this->fields = $fields;
        } else {
            $this->fields = func_get_args();
        }
        return $this;
    }
644111
protected function replaceCommonTemplates(&$stub, ViewInput $input, array $fields)
    {
        $viewLabels = new ViewLabelsGenerator($input->modelName, $fields, $this->isCollectiveTemplate());

        $standardLabels = $viewLabels->getLabels();

        $this->replaceModelName($stub, $input->modelName)
            ->replaceRouteNames($stub, $this->getModelName($input->modelName), $input->prefix)
            ->replaceViewNames($stub, $input->viewsDirectory, $input->prefix)
            ->replaceLayoutName($stub, $input->layout)
            ->replaceStandardLabels($stub, $standardLabels);

        return $this;
    }
1291209
protected function replaceClassName(&$stub)
    {

        $className = $this->scaffoldCommandObj->getObjName('Name') . 'Controller';
        $stub = str_replace('{{class}}', $className, $stub);

        return $this;
    }
71458
protected function replaceTableName(&$stub)
    {
        $table = $this->meta['table'];

        $stub = str_replace('{{table}}', $table, $stub);

        return $this;
    }
932440
public function addFields(array $fields)
    {
        collect($fields)->each(function ($field, $key) {
            if (! $field instanceof AttachmentField) {
                $field = [$key => $field];
            }

            $this->addField($field);
        });

        return $this;
    }
67627
protected function replaceNamespace(&$stub, $name)
    {
        $stub = str_replace(
            '{{namespace}}',
            $this->formGenerator->getClassInfo($name)->namespace,
            $stub
        );

        return $this;
    }
43059
public function setFields(array $fields)
    {
        $this->checkValidLoader();

        // Flatten
        $this->loaders[ $this->contextLoader ] = [];
        $this->addFields($fields);

        return $this;
    }
1254399
protected function replaceSchemaIndex(&$stub)
    {

        if ($schema = $this->scaffoldCommandObj->option('schema')) {
            $schemaArray = (new SchemaParser)->parse($schema);
        }


        // Create view index header fields
        $schema = (new SyntaxBuilder)->create($schemaArray, $this->scaffoldCommandObj->getMeta(), 'view-index-header');
        $stub = str_replace('{{header_fields}}', $schema, $stub);


        // Create view index content fields
        $schema = (new SyntaxBuilder)->create($schemaArray, $this->scaffoldCommandObj->getMeta(), 'view-index-content');
        $stub = str_replace('{{content_fields}}', $schema, $stub);


        return $this;
    }
438404
protected function replaceSoftDelete(&$stub, $replaceSoftDelete)
    {
        if ($replaceSoftDelete == 'yes') {
            $stub = str_replace('{{softDeletes}}', "use SoftDeletes;\n    ", $stub);
            $stub = str_replace('{{useSoftDeletes}}', "use Illuminate\Database\Eloquent\SoftDeletes;\n", $stub);
        } else {
            $stub = str_replace('{{softDeletes}}', '', $stub);
            $stub = str_replace('{{useSoftDeletes}}', '', $stub);
        }

        return $this;
    }
1332252
protected function replaceStandardLabels(&$stub, array $items)
    {
        foreach ($items as $labels) {
            foreach ($labels as $label) {
                $text = $label->isPlain ? sprintf("'%s'", $label->text) : sprintf("trans('%s')", $label->localeGroup);
                $stub = $this->strReplace($label->template, $text, $stub);
            }
        }

        return $this;
    }