public static function fromJson($json, $localeGroup, array $languages = [])
    {
        if (empty($json) || ($capsule = json_decode($json, true)) === null) {
            throw new Exception("The provided string is not a valid json.");
        }

        if (is_array($capsule) && !Helpers::isAssociative($capsule)) {
            // At this point we know the resource file is` using old convention
            // Set the fields
            $fields = FieldTransformer::fromArray($capsule, $localeGroup, $languages, true);

            return new Resource($fields);
        }

        return self::fromArray($capsule, $localeGroup, $languages);
    }
public static function fromJson($json, $localeGroup, array $languages = [])
    {
        if (empty($json) || ($capsule = json_decode($json, true)) === null) {
            throw new Exception("The provided string is not a valid json.");
        }

        if (is_array($capsule) && !Helpers::isAssociative($capsule)) {
            // At this point we know the resource file is` using old convention
            // Set the fields
            $fields = FieldTransformer::fromArray($capsule, $localeGroup, $languages, true);

            return new Resource($fields);
        }

        return self::fromArray($capsule, $localeGroup, $languages);
    }
public static function fromJson ( $ json , $ localeGroup , array $ languages = [ ] ) { if ( empty ( $ json ) || ( $ capsule = json_decode ( $ json , true ) ) === null ) { throw new Exception ( "The provided string is not a valid json." ) ; } if ( is_array ( $ capsule ) && ! Helpers :: isAssociative ( $ capsule ) ) { // At this point we know the resource file is` using old convention // Set the fields $ fields = FieldTransformer :: fromArray ( $ capsule , $ localeGroup , $ languages , true ) ; return new Resource ( $ fields ) ; } return self :: fromArray ( $ capsule , $ localeGroup , $ languages ) ; }
It transfres a given JSON string to a collection of field

@param string|json $json
@param string $localeGroup
@param array $languages

@return CrestApps\CodeGenerator\Models\Resource
It transfres a given JSON string to a collection of field