Call controller generator if user confirms

@param $resource
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'));
        }
    }
705815
protected function callSeeder($resource)
    {
        $tableName = str_plural($this->getModelName($resource));

        if ($this->confirm("Would you like a '$tableName' table seeder? [yes|no]"))
        {
            $this->call('generate:seed', compact('tableName'));
        }
    }
334744
private function help($resource = STDOUT)
    {
        $this->helper->writeLine(sprintf(
            self::HELP_TEMPLATE,
            $this->scriptName
        ), true, $resource);
    }
530411
protected function setError($resource)
    {
        if (is_string($resource)) {
            $this->getDriver()->setError(
                $resource, -1
            );
        } else {
            $this->getDriver()->setError(
                $this->realError($resource),
                $this->realErrorCode($resource)
            );
        }
    }
76888
protected function authorizeResource($resource)
    {
        if ($this->isEditing($resource)) {
            return $this->user()->can($resource . '.update');
        }

        return $this->user()->can($resource . '.create');
    }
535812
public function isAllowed($resource = Nette\Security\IAuthorizator::ALL, $privilege = Nette\Security\IAuthorizator::ALL)
	{
		$defaultNamespace = null;

		if (strpos($resource, ":") !== false) {
			$exploded = explode(":", $resource);
			if (count($exploded) == 2) {
				list($namespace, $resource) = $exploded;
				$defaultNamespace = $this->namespacesRepository->getDefaultNamespace();
				$this->namespacesRepository->setCurrentNamespace($namespace);
			}
		}

		foreach ($this->getRoles() as $role) {
			if ($this->getAuthorizator()->isAllowed($role, $resource, $privilege)) {
				$this->namespacesRepository->setCurrentNamespace($defaultNamespace);
				return true;
			}
		}

		$this->namespacesRepository->setCurrentNamespace($defaultNamespace);
		return false;
	}
174566
public function router($resource, $arguments)
	{
		// if this is an ajax call
		if ($this->is_restful())
		{
			// have the Controller_Rest router deal with it
			return parent::router($resource, $arguments);
		}

		// check if a input specific method exists
		$controller_method = strtolower(\Input::method()) . '_' . $resource;

		// fall back to action_ if no rest method is provided
		if ( ! method_exists($this, $controller_method))
		{
			$controller_method = 'action_'.$resource;
		}

		// check if the action method exists
		if (method_exists($this, $controller_method))
		{
			return call_fuel_func_array(array($this, $controller_method), $arguments);
		}

		// if not, we got ourselfs a genuine 404!
		throw new \HttpNotFoundException();
	}
208801
private function callController()
    {
        $name = $this->getResourceControllerName();

        if ($this->confirm("Create a controller ($name) for the $this->resource resource?")) {
            $arg = $this->getArgumentResource();
            $name = substr_replace($arg, str_plural($this->resource),
                strrpos($arg, $this->resource), strlen($this->resource));

            if ($this->repositoryContract) {
                $this->callCommandFile('controller', $name, 'controller_repository');
            }
            else {
                // if admin - update stub
                if (!str_contains($name, 'admin.')) {
                    $this->callCommandFile('controller', $name, 'controller');
                }
                else {
                    $this->callCommandFile('controller', $name, 'controller_admin');
                }
            }
        }
    }
421373
public function checkAccess($action, $resource)
    {
        if ((is_null($resource) || is_null($resource->getId())) && (empty($action) || in_array(strtolower($action), array('list', 'create', 'post')))) {
            return true;
        }

        if (!is_null($resource)) {
            $query = $this->createQueryBuilder();
            $query->andWhere($query->getRootAliases()[0] . '.id = ' . $this->addNamedParameter('id', $resource, $query));
            $result = $this->getOneOrNullResultFromQueryBuilder($query);
            if ($result) {
                return true;
            } else {
                $this->throwException('Access for this resource has been denied', 'access-denied');
            }
        }
    }
377550
protected function addResourceString(string $resource): void
    {
        $data = json_decode($resource, true);
        if (json_last_error() !== \JSON_ERROR_NONE) {
            if (function_exists('json_last_error_msg')) {
                throw new \InvalidArgumentException(json_last_error_msg(), json_last_error());
            }
            throw new \InvalidArgumentException("Error parsing JSON.", json_last_error());
        }

        $this->addResourceArray($data);
    }
572783
public function generateController()
    {
        if (!$this->confirm('Do you want to generate a controller?')) {
            return;
        }

        $this->console->call('generate:controller', [
            'name' => $this->getControllerName(),
            '--force' => $this->console->option('force'),
            '--scaffold' => true,
        ]);
    }
232866
public function resolveURL($resource)
    {
        // Skip blank resources
        if (empty($resource)) {
            return null;
        }

        // Resolve resource to reference
        $resource = $this->resolveResource($resource);

        // Resolve resource to url
        /** @var ResourceURLGenerator $generator */
        $generator = Injector::inst()->get(ResourceURLGenerator::class);
        return $generator->urlForResource($resource);
    }
1177211
public function hasResource($resource)
    {
        if (!isset($this->resourcesCached[$resource])) {
            if (isset($this->resources[$resource])) {
                $this->resourcesCached[$resource] = $this->resources[$resource];
            } else {
                $found = false;
                foreach ($this->resources as $resourceName) {
                    $regex = str_replace(
                        array("\*", "\?"), // wildcard chars
                        array('.*', '.'),   // regexp chars
                        preg_quote($resourceName)
                    );

                    if (preg_match('/^' . $regex . '$/is', $resource)) {
                        $found = true;
                    }
                }

                $this->resourcesCached[$resource] = $found;
            }
        }

        return $this->resourcesCached[$resource];
    }
414555
public function addResource(string ...$resource)
    {
        foreach ($resource as $_resource)
        {
            $this->resourceRegistry->save($_resource);
        }
    }
1231821
public function optionsAction( $resource )
	{
		$response = $this->createAdmin( $resource )->options( $this->getPsrRequest(), new Response() );
		return $this->setPsrResponse( $response );
	}
533953
public function onResourceCreated(\core_kernel_classes_Resource $resource) {
        foreach ($this->getInner() as $impl) {
            $impl->onResourceCreated($resource);
        }
    }
858575
public static function fromResource(Resource $resource)
    {
        if (!is_subclass_of($resource->model_class, Medools\Model::class)) {
            $message = 'Invalid Resource model_class in ' . static::class . ': '
                . $resource->model_class;
            throw new \LogicException($message);
        }

        $controller = new static;

        $list = $resource->getList();
        if (empty($list)) {
            return false;
        }

        foreach ($list as $id) {
            if (!$controller->generate($id)) {
                return false;
            }
        }

        if ($resource->content_type === 'application/zip') {
            $controller->zip();
        } else {
            $controller->output();
        }

        return true;
    }