src/Console/Commands/DataTableMakeCommand.php
protected function replaceClasses($stub, $model, $transformer = null): string
    {
        if ($transformer) {
            $transformer = str_replace('/', '\\', $transformer);

            $namespaceTransformer = $this->rootNamespace().'\Transformers\\'.$transformer;

            if (starts_with($transformer, '\\')) {
                $stub = str_replace('NamespacedDummyTransformer', trim($transformer, '\\'), $stub);
            } else {
                $stub = str_replace('NamespacedDummyTransformer', $namespaceTransformer, $stub);
            }

            $stub = str_replace(
                "use {$namespaceTransformer};\nuse {$namespaceTransformer};", "use {$namespaceTransformer};", $stub
            );

            $transformer = class_basename(trim($transformer, '\\'));

            $stub = str_replace('DummyTransformer', $transformer, $stub);

            $stub = str_replace('dummyTransformer', camel_case($transformer), $stub);
        }

        $model = str_replace('/', '\\', $model);

        $namespaceModel = $this->rootNamespace().'\Models\\'.$model;

        if (starts_with($model, '\\')) {
            $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub);
        } else {
            $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub);
        }

        $stub = str_replace(
            "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub
        );

        $model = class_basename(trim($model, '\\'));

        $stub = str_replace('DummyModel', $model, $stub);

        return str_replace('dummyModel', camel_case($model), $stub);
    }
protected function replaceClasses($stub, $model, $transformer = null): string
    {
        if ($transformer) {
            $transformer = str_replace('/', '\\', $transformer);

            $namespaceTransformer = $this->rootNamespace().'\Transformers\\'.$transformer;

            if (starts_with($transformer, '\\')) {
                $stub = str_replace('NamespacedDummyTransformer', trim($transformer, '\\'), $stub);
            } else {
                $stub = str_replace('NamespacedDummyTransformer', $namespaceTransformer, $stub);
            }

            $stub = str_replace(
                "use {$namespaceTransformer};\nuse {$namespaceTransformer};", "use {$namespaceTransformer};", $stub
            );

            $transformer = class_basename(trim($transformer, '\\'));

            $stub = str_replace('DummyTransformer', $transformer, $stub);

            $stub = str_replace('dummyTransformer', camel_case($transformer), $stub);
        }

        $model = str_replace('/', '\\', $model);

        $namespaceModel = $this->rootNamespace().'\Models\\'.$model;

        if (starts_with($model, '\\')) {
            $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub);
        } else {
            $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub);
        }

        $stub = str_replace(
            "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub
        );

        $model = class_basename(trim($model, '\\'));

        $stub = str_replace('DummyModel', $model, $stub);

        return str_replace('dummyModel', camel_case($model), $stub);
    }
protected function replaceClasses ( $ stub , $ model , $ transformer = null ) : string { if ( $ transformer ) { $ transformer = str_replace ( '/' , '\\' , $ transformer ) ; $ namespaceTransformer = $ this -> rootNamespace ( ) . '\Transformers\\' . $ transformer ; if ( starts_with ( $ transformer , '\\' ) ) { $ stub = str_replace ( 'NamespacedDummyTransformer' , trim ( $ transformer , '\\' ) , $ stub ) ; } else { $ stub = str_replace ( 'NamespacedDummyTransformer' , $ namespaceTransformer , $ stub ) ; } $ stub = str_replace ( "use {$namespaceTransformer};\nuse {$namespaceTransformer};" , "use {$namespaceTransformer};" , $ stub ) ; $ transformer = class_basename ( trim ( $ transformer , '\\' ) ) ; $ stub = str_replace ( 'DummyTransformer' , $ transformer , $ stub ) ; $ stub = str_replace ( 'dummyTransformer' , camel_case ( $ transformer ) , $ stub ) ; } $ model = str_replace ( '/' , '\\' , $ model ) ; $ namespaceModel = $ this -> rootNamespace ( ) . '\Models\\' . $ model ; if ( starts_with ( $ model , '\\' ) ) { $ stub = str_replace ( 'NamespacedDummyModel' , trim ( $ model , '\\' ) , $ stub ) ; } else { $ stub = str_replace ( 'NamespacedDummyModel' , $ namespaceModel , $ stub ) ; } $ stub = str_replace ( "use {$namespaceModel};\nuse {$namespaceModel};" , "use {$namespaceModel};" , $ stub ) ; $ model = class_basename ( trim ( $ model , '\\' ) ) ; $ stub = str_replace ( 'DummyModel' , $ model , $ stub ) ; return str_replace ( 'dummyModel' , camel_case ( $ model ) , $ stub ) ; }
Replace the model and transformer for the given stub.

@param string $stub
@param string $model
@param string $transformer

@return string
Replace the model and transformer for the given stub .