public static function forTheme($theme)
    {
        $dirName = $theme->getDirName();
        if ($themeData = array_get(self::$instances, $dirName)) {
            return $themeData;
        }

        try {
            $themeData = self::firstOrCreate(['theme' => $dirName]);
        }
        catch (Exception $ex) {
            // Database failed
            $themeData = new self(['theme' => $dirName]);
        }

        return self::$instances[$dirName] = $themeData;
    }
public static function forTheme($theme)
    {
        $dirName = $theme->getDirName();
        if ($themeData = array_get(self::$instances, $dirName)) {
            return $themeData;
        }

        try {
            $themeData = self::firstOrCreate(['theme' => $dirName]);
        }
        catch (Exception $ex) {
            // Database failed
            $themeData = new self(['theme' => $dirName]);
        }

        return self::$instances[$dirName] = $themeData;
    }
public static function forTheme ( $ theme ) { $ dirName = $ theme -> getDirName ( ) ; if ( $ themeData = array_get ( self :: $ instances , $ dirName ) ) { return $ themeData ; } try { $ themeData = self :: firstOrCreate ( [ 'theme' => $ dirName ] ) ; } catch ( Exception $ ex ) { // Database failed $ themeData = new self ( [ 'theme' => $ dirName ] ) ; } return self :: $ instances [ $ dirName ] = $ themeData ; }
Returns a cached version of this model, based on a Theme object.
@param $theme Cms\Classes\Theme
@return self
Returns a cached version of this model based on a Theme object .