src/Module.php
public function model($name, $inject = null) {

        // Model instance
        $instance = function($path) use ($inject) {

            if(class_exists($namespace = 'App\\Modules\\' . str_replace('/', '\\', $path))) {

                return new $namespace($inject);
            }
        };


        // Split module and model name
        if(strstr($name, '/')) {

            $name = explode('/', $name);

            return $instance($name[0] . '/Models/' . $name[1]);
        }


        if(isset($this->module['name'])) {

            if($model = $instance($this->module['name'] . '/Models/'. $name)) {

                return $model;
            }
        }

        // Use module name if model name is not defined
        return $instance($name . '/Models/' . $name);
    }
public function model($name, $inject = null) {

        // Model instance
        $instance = function($path) use ($inject) {

            if(class_exists($namespace = 'App\\Modules\\' . str_replace('/', '\\', $path))) {

                return new $namespace($inject);
            }
        };


        // Split module and model name
        if(strstr($name, '/')) {

            $name = explode('/', $name);

            return $instance($name[0] . '/Models/' . $name[1]);
        }


        if(isset($this->module['name'])) {

            if($model = $instance($this->module['name'] . '/Models/'. $name)) {

                return $model;
            }
        }

        // Use module name if model name is not defined
        return $instance($name . '/Models/' . $name);
    }
public function model ( $ name , $ inject = null ) { // Model instance $ instance = function ( $ path ) use ( $ inject ) { if ( class_exists ( $ namespace = 'App\\Modules\\' . str_replace ( '/' , '\\' , $ path ) ) ) { return new $ namespace ( $ inject ) ; } } ; // Split module and model name if ( strstr ( $ name , '/' ) ) { $ name = explode ( '/' , $ name ) ; return $ instance ( $ name [ 0 ] . '/Models/' . $ name [ 1 ] ) ; } if ( isset ( $ this -> module [ 'name' ] ) ) { if ( $ model = $ instance ( $ this -> module [ 'name' ] . '/Models/' . $ name ) ) { return $ model ; } } // Use module name if model name is not defined return $ instance ( $ name . '/Models/' . $ name ) ; }
Get model from it's module and other modules

@param string $name
Get model from it s module and other modules