src/Console/MakeTransformer.php
protected function generateTransformer()
    {
        $name = (string) $this->argument('name');
        $path = $this->laravel->basePath() . '/app/Transformers/' . $name . '.php';

        if ($this->files->exists($path)) {
            return $this->error($name . ' already exists!');
        }

        $this->makeDirectory($path);

        $stubPath = $this->option('pivot') ? 'resources/stubs/transformer.pivot.stub' : 'resources/stubs/transformer.stub';
        $stub = $this->files->get(__DIR__ . '/../../' . $stubPath);

        $this->files->put($path, $this->makeTransformer($name, $stub));

        $this->info('Transformer created successfully.');
    }
protected function generateTransformer()
    {
        $name = (string) $this->argument('name');
        $path = $this->laravel->basePath() . '/app/Transformers/' . $name . '.php';

        if ($this->files->exists($path)) {
            return $this->error($name . ' already exists!');
        }

        $this->makeDirectory($path);

        $stubPath = $this->option('pivot') ? 'resources/stubs/transformer.pivot.stub' : 'resources/stubs/transformer.stub';
        $stub = $this->files->get(__DIR__ . '/../../' . $stubPath);

        $this->files->put($path, $this->makeTransformer($name, $stub));

        $this->info('Transformer created successfully.');
    }
protected function generateTransformer ( ) { $ name = ( string ) $ this -> argument ( 'name' ) ; $ path = $ this -> laravel -> basePath ( ) . '/app/Transformers/' . $ name . '.php' ; if ( $ this -> files -> exists ( $ path ) ) { return $ this -> error ( $ name . ' already exists!' ) ; } $ this -> makeDirectory ( $ path ) ; $ stubPath = $ this -> option ( 'pivot' ) ? 'resources/stubs/transformer.pivot.stub' : 'resources/stubs/transformer.stub' ; $ stub = $ this -> files -> get ( __DIR__ . '/../../' . $ stubPath ) ; $ this -> files -> put ( $ path , $ this -> makeTransformer ( $ name , $ stub ) ) ; $ this -> info ( 'Transformer created successfully.' ) ; }
Generate the transformer class.

@return void
Generate the transformer class .