Call generate:controller

@return void
190174
protected function generateController()
    {
        $name = Pluralizer::plural($this->model);

        $this->call(
            'generate:controller',
            array(
                'name' => "{$name}Controller",
                '--template' => $this->getControllerTemplatePath()
            )
        );
    }
822357
public function actionGenerate()
	{
		$tableName = Enter::display('Enter table name');
		$className = MigrationHelper::generateByTableName($tableName);
		Output::block($className, 'Migration created!');
	}
991785
public function makeController()
    {
        $this->options['name'] = ucfirst($this->ask('Controller Name (Example: MyController)'));

        // Resourceful Controller
        if ($this->confirm('Is this controller resourceful?')) {
            $this->options['-r'] = '--resource';
        }

        // Model Controller
        if ($this->confirm('Would you like to use route model binding?')) {
            $this->options['--model'] = $this->ask('Please enter the name of the model');
        }
    }
308947
public function run() {
        $this->_hookManager->runBeforeSystem();

        $urlArray = explode('/', $this->_url);
        //Deletes last element if empty
        $lastElement = end($urlArray);
        if ($lastElement == '') {
            array_pop($urlArray);
        }
        reset($urlArray);

        // If present take the first element as the controller
        $tmpController = isset($urlArray[0]) ? array_shift($urlArray) : 'index';
        $action = null;

        //Prepare the GET params in order to pass them to the Controller
        $myGet = $_GET;
        if(isset($myGet['url'])){
            unset($myGet['url']);
        }

        if ($this->applyStaticRouting($tmpController)) {
            $this->_hookManager->runBefore(); // Runs before controller hooks
            include(ROOT . DS . $tmpController);
            $this->_hookManager->runAfter(); // Runs after controller hooks
        } elseif ($this->applyRouting($tmpController, $action, $urlArray)) {
            ($action === null) ? $action = 'index' : $action;
            $tmpController = '\\pff\\controllers\\'.$tmpController;
            $controller = new $tmpController($tmpController, $this, $action, array_merge($urlArray,$myGet));
        } elseif (file_exists(ROOT . DS . 'app' . DS . 'controllers' . DS . ucfirst($tmpController) . '_Controller.php')) {
            $action = isset($urlArray[0]) ? array_shift($urlArray) : 'index';
            $controllerClassName = '\\pff\\controllers\\'.ucfirst($tmpController) . '_Controller';
            $controller          = new $controllerClassName($tmpController, $this, $action, array_merge($urlArray,$myGet));
        } else {
            throw new RoutingException('Cannot find a valid controller.', 404);
        }

        if (isset($controller)) {
            $this->_action = $action;
            $this->_moduleManager->setController($controller); // We have a controller, let the modules know about it
            ob_start();
            $this->_hookManager->runBefore(); // Runs before controller hooks
            if ((int)method_exists($controller, $this->_action)) {
                call_user_func_array(array($controller, "beforeAction"), $urlArray);
                call_user_func(array($controller, "beforeFilter"));
                call_user_func_array(array($controller, $this->_action), $urlArray);
                call_user_func(array($controller, "afterFilter"));
                call_user_func_array(array($controller, "afterAction"), $urlArray);
                $this->_hookManager->runAfter(); // Runs after controller hooks
                ob_end_flush();
            } else {
                throw new RoutingException('Not a valid action: ' . $action, 404);
            }
        }
    }
762214
public function dispatch()
    {

        $name = $this->generateClassName($this->namespace, $this->class);

        // the controller instance
        $controller = App::make($name);


        if ($controller instanceof Controller) {
            // register the parameters
            $controller->runControllerWithParameters(ParameterBag::getParameters());


            // return the instance
            return $controller;
        } else {
            throw new ControllerException(sprintf('%s is not a instance of  controller', $name));
        }
    }
39292
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);
    }
1123132
public function handle()
    {
        parent::handle();

        $controllerGenerator = new APIControllerGenerator($this->commandData);
        $controllerGenerator->generate();

        $this->performPostActions();
    }
352441
protected function callController($resource)
    {
        $controllerName = $this->getControllerName($resource);

        if ($this->confirm("Do you want me to create a $controllerName controller? [yes|no]"))
        {
            $this->call('generate:controller', compact('controllerName'));
        }
    }
966145
protected function generateCrudControllerClass() {
        $dir = $this->bundle->getPath();

        $parts = explode('\\', $this->entity);
        $entityClass = array_pop($parts);
        $entityNamespace = implode('\\', $parts);

        $target = sprintf(
                '%s/Controller/%s/%sController.php', $dir, str_replace('\\', '/', $entityNamespace), $entityClass
        );

        if (!$this->config->getOverwrite() && file_exists($target)) {
            throw new \RuntimeException('Unable to generate the controller as it already exists.');
        }

        $this->renderFile('crud/controller.php.twig', $target, array(
            'actions' => $this->actions,
            'route_prefix' => $this->config->getRoutePrefix(),
            'route_name_prefix' => $this->routeNamePrefix,
            'bundle' => $this->bundle->getName(),
            'entity' => $this->entity,
            'entity_singularized' => $this->entitySingularized,
            'entity_pluralized' => $this->entityPluralized,
            'entity_class' => $entityClass,
            'namespace' => $this->bundle->getNamespace(),
            'entity_namespace' => $entityNamespace,
            'format' => $this->config->getFormat(),
            'bundle_views' => $this->config->getBundleViews(),
            'filter_type' => $this->config->getFilterTYpe(),
            'without_sorting' => $this->config->getWithoutSorting(),
            'without_page_size' => $this->config->getWithoutPageSize(),
            'identifier' => $this->metadata->identifier[0],

        ));
    }
940472
public function run()
    {
        if (!$this->overrideFile()) {
            $this->output->writeln("<info>File was skipped. The controller was not created.</info>");
            return true;
        }
        $data = $this->getControllerMetaData()->getData();
        $data = array_merge(
            $data,
            [
                'controllerName' => $this->controllerName,
                'namespace' => $this->namespace,
                'basePath' => $this->getBasePath()
            ]
        );
        $content = $this->getTemplateEngine()
            ->parse($this->template)
            ->process($data);
        file_put_contents($this->getControllerFile(), $content);
        return true;
    }
880756
public function runController()
    {
        return (new ControllerDispatcher($this->container))->dispatch(
            $this, $this->getController(), $this->getControllerMethod()
        );
    }
815524
public function generate()
    {
        if (empty($this->hosts)) {
            $host = $this->router->getContext()->getHost();
            $this->hosts = [$host];
        }
        if ($this->scheme === null) {
            $this->scheme = $this->router->getContext()->getScheme();
        }
        $schemeMode = Host::SCHEME_HTTP;
        if ($this->scheme == 'https') {
            $schemeMode = Host::SCHEME_HTTPS;
        } elseif ($this->scheme == 'https_only') {
            $schemeMode = Host::SCHEME_ONLY_HTTPS;
        }
        if (file_exists($this->webDir.'/robots.txt')) {
            unlink($this->webDir.'/robots.txt');
        }
        foreach ($this->hosts as $hostName) {
            $postfix = (count($this->hosts) > 1 ? '.'.$hostName : '');
            $host = new Host($hostName, $schemeMode, $this->port);
            $sitemap = new Sitemap($host);
            $this->configureRobotsFile($sitemap->getRobotsFile());
            $event = new SitemapGenerateEvent($sitemap);
            $this->eventDispatcher->dispatch(SitemapGenerateEvent::ON_SITEMAP_GENERATE, $event);
            $sitemap->save($this->webDir, $this->gzip, $postfix);
        }
    }
199899
protected function generate()
    {
        $steps = [
            'Generating module...' => 'generateModule',
            'Optimizing module cache...' => 'optimizeModules',
        ];

        $progress = new ProgressBar($this->output, count($steps));
        $progress->start();

        foreach ($steps as $message => $function) {
            $progress->setMessage($message);

            $this->$function();

            $progress->advance();
        }

        $progress->finish();

        event($this->container['slug'] . '.module.made');

        $this->info("\nModule generated successfully.");
    }
624362
final public function generate() {
        $options = array_merge($this->options, (array) 'generate');
        Generator::call($this->called, $this->args, $options);
    }
1250573
private function generateViews()
    {
        $viewInstance = View::instance($this);
        $viewInstance->setLayoutType($this->viewType);
        $viewTemplateDir = dirname(dirname(__FILE__)).DS.'src'.DS.'Apps'.DS.'Views'.DS;
        $viewInstance->setTableColumns($this->columns);
        $viewInstance->setViewTemplatePath($viewTemplateDir);

        // generate twig template layout if type has set via user
        if ($this->viewType == 'php') {
            // Type not set then we will generate php layout
            $viewInstance->generateLayout('layouts');
        } else {
            $viewInstance->generateLayout('layouts.main');
        }

        $viewInstance->generateViews();

        $this->info(
            'Views Generated In '.str_replace('Controller', '', $this->controller).' Directory..'
        );
    }
245193
public function generateRoutes()
    {
        $routes = property_exists(app(), 'router')? app()->router->getRoutes() : app()->getRoutes();
        foreach ($routes as $route) {
            array_push($this->routes, [
                'method' => $route['method'],
                'uri' => $route['uri'],
                'name' => $this->getRouteName($route),
                'action' => $this->getRouteAction($route),
                'middleware' => $this->getRouteMiddleware($route),
                'map' => $this->getRouteMapTo($route)
            ]);
        }
    }
698142
public function fire()
    {
        $generator = new ControllerGenerator([
            'name' => $this->argument('name'),
            'resource' => $this->option('resource'),
            'scaffold' => $this->option('scaffold'),
            'force' => $this->option('force'),
        ]);

        $generator->run();

        $this->info('Controller created successfully.');
    }