Returns the route path for a given model FQN.

@param string $modelClass
@param bool   $prefix        whether to include CMS & model module prefixes
@return string
506217
public function getRoutePathForModelClass($modelClass, $prefix = false)
    {
        $modelSlug = $this->getRouteSlugForModelClass($modelClass);

        if ( ! $prefix) {
            return $modelSlug;
        }

        return config('cms-core.route.prefix')
             . config('cms-models.route.prefix') . '/'
             . $modelSlug;
    }
909068
public function domClass($recordOrClass, $prefix = null)
    {
        $singular = snake_case(camel_case(preg_replace('/\\\\/', ' ', $this->modelNameFromRecordOrClassname($recordOrClass))));
        return $prefix ? $prefix.'_'.$singular : $singular;
    }
828375
public function link(Model $model)
    {
        if ( ! $this->routePrefix || ! $this->isPermitted) {
            return false;
        }

        return route($this->routePrefix . static::ROUTE_POSTFIX, [ $model->getKey() ]);
    }
517330
public static function GetControllerClassPath ($route, $namespace) {
		$class_path = "\\". implode("\\", [$namespace, 'app', 'controllers', $route['controller'], Strings::ToUpperCamelCase($route['controller']) . 'Controller']);
		if (!class_exists($class_path)) {
			$class_path = "\\". implode("\\", [__NAMESPACE__, 'app', 'controllers', 'UnkownController']);
		}
		return $class_path;
	}
355876
public function paginateChildren($modelClass, $method, array $params = [])
    {
        // Set request params
        $params = array_filter(array_merge([
            'page' => 1
        ], $params));

        // Make request
        $result = $this->makeRequest($this->getEndpoint(), $method, [$this->getKey(), $params]);

        // Hydrate object
        $result = $this->paginateHydrate($result, $modelClass);

        // Append search params
        $result->appends($params);

        return $result;
    }
485724
public function getClassMetadata(Driver $driver, $modelClass)
    {
        $manager = $this->managerFactory->getManager($driver);
        $manager->setModelClass($modelClass);

        return $manager->getClassMetadata();
    }
401719
protected function getModelRouteNameSegment($routeName = null)
    {
        $routeName = $routeName ?: $this->getRouteName();

        $combinedPrefix = config('cms-core.route.name-prefix')
                        . config('cms-models.route.name-prefix')
                        . static::MODEL_ROUTE_NAME_PREFIX;

        if ( ! starts_with($routeName, $combinedPrefix)) {
            return false;
        }

        return substr($routeName, strlen($combinedPrefix));
    }
1191319
protected function getPathBuilder($prefix)
    {
        return function ($value) use (&$prefix) {
            $prefix .= static::SEP_MAJOR . $this->fixString($value);
            return $prefix;
        };
    }
1352018
public function getModelsClasses($modelsPath, $modelsNamespace)
    {
        $path = Yii::getAlias($modelsPath);
        $files = @scandir($path);

        if ($files === false) {
            throw new InvalidConfigException('Path to sitemap models "' . $modelsPath . '"(' .
                $path . ') is incorrect');
        }

        $buffer = [];
        foreach ($files as $file) {
            if ($file == '.' || $file == '..' || !is_file($path . DIRECTORY_SEPARATOR . $file)) {
                continue;
            }

            // Search only .php files
            $ext = substr($file, -4);
            if ($ext !== '.php') {
                continue;
            }

            // Combine model class name
            $className = $modelsNamespace . '\\' . str_replace($ext, '', $file);

            // Create new model instance
            $model = Yii::createObject($className);

            if (!$model instanceof Basic) {
                $this->printMessage('Warning: model "' . $className . '" does not implement interface ' .
                    '"demi\sitemap\interfaces\Basic"');

                continue;
            }

            // Add class to list
            $buffer[] = $model;

            // Analysis xml-schemas by $model interfaces
            $this->collectSchemas($model);
        }

        return $buffer;
    }
1124009
protected function getModelNamespace($modelPath)
    {
        $appNamespace = trim($this->getAppNamespace(), '\\');
        $modelNamespace = str_replace('/', '\\', $appNamespace.'/'.ucfirst($modelPath));
        $modelNamespace = trim($modelNamespace, '\\');
        return $modelNamespace == 'App\\' ? 'App' : $modelNamespace;
    }
1358616
protected function namespaceModelClass(string $modelClassCandidate): string
    {
        return $this->namespaceClassName(
            $modelClassCandidate,
            (array) config('lighthouse.namespaces.models'),
            function (string $classCandidate): bool {
                return is_subclass_of($classCandidate, Model::class);
            }
        );
    }
341996
public <T> T getModel(Class<T> modelClass) {
		return (T)Injector.injectModel(modelClass, request, false);
	}
433168
public function prefix(string $prefix): Route
	{
		if(!empty($prefix))
		{
			$this->prefix .= '/' . trim($prefix, '/');
		}

		return $this;
	}
615509
public function toClassPath($class)
    {
        $parts = explode(self::ROUTE_SYNTAX_DELIMITER, $class);

        $module = $parts[0];
        unset($parts[0]);

        $path = sprintf('/%s/%s/%s', $module, self::ROUTE_CONTROLLER_DIR, implode('/', $parts));

        return $path;
    }
324559
public function resolveModelClass(Route $route): string
	{
		// The plural resource name is always the second URL segment, after the API version
		$route_name = $route->getName();

		if (! is_null($route_name) && strpos($route_name, '.') !== false) {
			list(, $alias) = array_reverse(explode('.', $route->getName()));

			$model_class = $this->namespaceModel(Str::studly(Str::singular($alias)));

			if (is_a($model_class, MagicBoxResource::class, true)) {
				return $model_class;
			}

			throw new \LogicException(sprintf('%s must be an instance of %s', $model_class, MagicBoxResource::class));
		}

		throw new \LogicException('Unable to resolve model from improperly named route');
	}
1042485
public function getByModelClass($class)
    {
        $this->checkInitialization();

        if ( ! array_key_exists($class, $this->modelClassIndex)) {
            return false;
        }

        return $this->getByKey($this->modelClassIndex[$class]);
    }
1069367
protected function getModelModuleKeyForRouteNameSegment($nameSegment)
    {
        if (false === $nameSegment) {
            return false;
        }

        return ModuleHelper::MODULE_PREFIX . $this->getModelSlugForRouteNameSegment($nameSegment);
    }