src/Controller.php
private function fetchModelInfo($module, $model = false)
    {
        // instantiate the controller
        $controller = '\\app\\'.$module.'\\Controller';
        $controllerObj = new $controller($this->app);

        // get info about the controller
        $properties = $controller::$properties;

        // fetch all available models from the controller
        $availableModels = $this->models($controllerObj);

        // look for a default model
        if (!$model) {
            // when there is only one choice, use it
            if (count($availableModels) == 1) {
                return reset($availableModels);
            } else {
                $model = U::array_value($properties, 'defaultModel');
            }
        }

        // convert the route name to the pluralized name
        $inflector = Inflector::get();
        $modelName = $inflector->singularize($inflector->camelize($model));

        // attempt to fetch the model info
        return U::array_value($availableModels, $modelName);
    }
private function fetchModelInfo($module, $model = false)
    {
        // instantiate the controller
        $controller = '\\app\\'.$module.'\\Controller';
        $controllerObj = new $controller($this->app);

        // get info about the controller
        $properties = $controller::$properties;

        // fetch all available models from the controller
        $availableModels = $this->models($controllerObj);

        // look for a default model
        if (!$model) {
            // when there is only one choice, use it
            if (count($availableModels) == 1) {
                return reset($availableModels);
            } else {
                $model = U::array_value($properties, 'defaultModel');
            }
        }

        // convert the route name to the pluralized name
        $inflector = Inflector::get();
        $modelName = $inflector->singularize($inflector->camelize($model));

        // attempt to fetch the model info
        return U::array_value($availableModels, $modelName);
    }
private function fetchModelInfo ( $ module , $ model = false ) { // instantiate the controller $ controller = '\\app\\' . $ module . '\\Controller' ; $ controllerObj = new $ controller ( $ this -> app ) ; // get info about the controller $ properties = $ controller :: $ properties ; // fetch all available models from the controller $ availableModels = $ this -> models ( $ controllerObj ) ; // look for a default model if ( ! $ model ) { // when there is only one choice, use it if ( count ( $ availableModels ) == 1 ) { return reset ( $ availableModels ) ; } else { $ model = U :: array_value ( $ properties , 'defaultModel' ) ; } } // convert the route name to the pluralized name $ inflector = Inflector :: get ( ) ; $ modelName = $ inflector -> singularize ( $ inflector -> camelize ( $ model ) ) ; // attempt to fetch the model info return U :: array_value ( $ availableModels , $ modelName ) ; }
Takes the pluralized model name from the route and gets info about the model.

@param string $modelRouteName the name that comes from the route (i.e. the route "/users" would supply "users")

@return array|null model info
Takes the pluralized model name from the route and gets info about the model .