classes/Commands/Generate.php
private function generateController()
    {
        // Figure out the naming
        $controller = Str::plural(ucfirst($this->argument('model')));
        $path = 'app/Http/Controllers/Admin/'.$controller.'.php';
        $file = base_path().'/'.$path;

        // Copy the stub over
        if (!file_exists(dirname($file))) {
            mkdir(dirname($file), 0744, true);
        }
        if (file_exists($file)) {
            return $this->comment('Controller already exists: '.$path);
        }
        file_put_contents($file, str_replace('{{controller}}', $controller, file_get_contents($this->stubs.'/controller.stub')));
        $this->info('Controller created: '.$path);
    }
private function generateController()
    {
        // Figure out the naming
        $controller = Str::plural(ucfirst($this->argument('model')));
        $path = 'app/Http/Controllers/Admin/'.$controller.'.php';
        $file = base_path().'/'.$path;

        // Copy the stub over
        if (!file_exists(dirname($file))) {
            mkdir(dirname($file), 0744, true);
        }
        if (file_exists($file)) {
            return $this->comment('Controller already exists: '.$path);
        }
        file_put_contents($file, str_replace('{{controller}}', $controller, file_get_contents($this->stubs.'/controller.stub')));
        $this->info('Controller created: '.$path);
    }
private function generateController ( ) { // Figure out the naming $ controller = Str :: plural ( ucfirst ( $ this -> argument ( 'model' ) ) ) ; $ path = 'app/Http/Controllers/Admin/' . $ controller . '.php' ; $ file = base_path ( ) . '/' . $ path ; // Copy the stub over if ( ! file_exists ( dirname ( $ file ) ) ) { mkdir ( dirname ( $ file ) , 0744 , true ) ; } if ( file_exists ( $ file ) ) { return $ this -> comment ( 'Controller already exists: ' . $ path ) ; } file_put_contents ( $ file , str_replace ( '{{controller}}' , $ controller , file_get_contents ( $ this -> stubs . '/controller.stub' ) ) ) ; $ this -> info ( 'Controller created: ' . $ path ) ; }
Create the controller file
Create the controller file