src/Factory/ContentFactory.php
/**
     * Fetch an existing record or create a new one,
     * based on the specified criteria (in setcontent-like format).
     */
Fetch an existing record or create a new one,
based on the specified criteria (in setcontent-like format).
Fetch an existing record or create a new one based on the specified criteria ( in setcontent - like format ) .
public function upsert(string $query, array $parameters = []): Content
    {
        $parameters['returnsingle'] = true;
        unset($parameters['returnmultiple']);
        $content = $this->query->getContent($query, $parameters);
        if (! $content instanceof Content) {
            $contentType = $this->config->getContentType($query);
            $content = $this->create($contentType->getSlug());
        }
        return $content;
    }
public function upsert ( string $ query , array $ parameters = [ ] ) : Content { $ parameters [ 'returnsingle' ] = true ; unset ( $ parameters [ 'returnmultiple' ] ) ; $ content = $ this -> query -> getContent ( $ query , $ parameters ) ; if ( ! $ content instanceof Content ) { $ contentType = $ this -> config -> getContentType ( $ query ) ; $ content = $ this -> create ( $ contentType -> getSlug ( ) ) ; } return $ content ; }
Fetch an existing record or create a new one,
 based on the specified criteria (in setcontent-like format).
Fetch an existing record or create a new one based on the specified criteria ( in setcontent - like format ) .
/** @var ContentType $contentType */