public function generate($controller)
    {
        // We create command generator instance
        $generator = new Generator(
            $this->setting->getControllerDirectory(),
            $controller
        );

        // We check if the file already exists
        if ($generator->fileExists()) {
            echo Color::danger('The controller already exists');

            exit(1);
        }

        // We create the resource url prefix
        $prefix = preg_replace("/controller/i", "", strtolower($controller));
        $model = ucfirst($prefix);
        $prefix = '/'.trim($prefix, '/');

        $model_namespace = '';

        $options = $this->arg->options();

        // We check if --with-view exists. If that exists,
        // we launch the question
        if ($options->has('--with-view')
            && $this->readline("Do you want me to create the associated views? ")
        ) {
            $model = preg_replace("/controller/i", "", strtolower($controller));

            $model = strtolower($model);

            $this->createDefaultView($model, $filename);
        }

        $prefix = Str::plurial(Str::snake($prefix));

        $this->createResourceController(
            $generator,
            $prefix,
            $controller,
            $model_namespace
        );

        exit(0);
    }
public function generate($controller)
    {
        // We create command generator instance
        $generator = new Generator(
            $this->setting->getControllerDirectory(),
            $controller
        );

        // We check if the file already exists
        if ($generator->fileExists()) {
            echo Color::danger('The controller already exists');

            exit(1);
        }

        // We create the resource url prefix
        $prefix = preg_replace("/controller/i", "", strtolower($controller));
        $model = ucfirst($prefix);
        $prefix = '/'.trim($prefix, '/');

        $model_namespace = '';

        $options = $this->arg->options();

        // We check if --with-view exists. If that exists,
        // we launch the question
        if ($options->has('--with-view')
            && $this->readline("Do you want me to create the associated views? ")
        ) {
            $model = preg_replace("/controller/i", "", strtolower($controller));

            $model = strtolower($model);

            $this->createDefaultView($model, $filename);
        }

        $prefix = Str::plurial(Str::snake($prefix));

        $this->createResourceController(
            $generator,
            $prefix,
            $controller,
            $model_namespace
        );

        exit(0);
    }
public function generate ( $ controller ) { // We create command generator instance $ generator = new Generator ( $ this -> setting -> getControllerDirectory ( ) , $ controller ) ; // We check if the file already exists if ( $ generator -> fileExists ( ) ) { echo Color :: danger ( 'The controller already exists' ) ; exit ( 1 ) ; } // We create the resource url prefix $ prefix = preg_replace ( "/controller/i" , "" , strtolower ( $ controller ) ) ; $ model = ucfirst ( $ prefix ) ; $ prefix = '/' . trim ( $ prefix , '/' ) ; $ model_namespace = '' ; $ options = $ this -> arg -> options ( ) ; // We check if --with-view exists. If that exists, // we launch the question if ( $ options -> has ( '--with-view' ) && $ this -> readline ( "Do you want me to create the associated views? " ) ) { $ model = preg_replace ( "/controller/i" , "" , strtolower ( $ controller ) ) ; $ model = strtolower ( $ model ) ; $ this -> createDefaultView ( $ model , $ filename ) ; } $ prefix = Str :: plurial ( Str :: snake ( $ prefix ) ) ; $ this -> createResourceController ( $ generator , $ prefix , $ controller , $ model_namespace ) ; exit ( 0 ) ; }
Command used to set up the resource system.

@param  string $controller

@return void
@throws
Command used to set up the resource system .