src/Metable.php
public function setMeta(string $key, $value)
    {
        if ($this->hasMeta($key)) {
            $meta = $this->getMetaRecord($key);
            $meta->setAttribute('value', $value);
            $meta->save();
        } else {
            $meta = $this->makeMeta($key, $value);
            $this->meta()->save($meta);
        }

        // Update cached relationship, if necessary.
        if ($this->relationLoaded('meta')) {
            $this->meta[$key] = $meta;
        }
    }
public function setMeta(string $key, $value)
    {
        if ($this->hasMeta($key)) {
            $meta = $this->getMetaRecord($key);
            $meta->setAttribute('value', $value);
            $meta->save();
        } else {
            $meta = $this->makeMeta($key, $value);
            $this->meta()->save($meta);
        }

        // Update cached relationship, if necessary.
        if ($this->relationLoaded('meta')) {
            $this->meta[$key] = $meta;
        }
    }
public function setMeta ( string $ key , $ value ) { if ( $ this -> hasMeta ( $ key ) ) { $ meta = $ this -> getMetaRecord ( $ key ) ; $ meta -> setAttribute ( 'value' , $ value ) ; $ meta -> save ( ) ; } else { $ meta = $ this -> makeMeta ( $ key , $ value ) ; $ this -> meta ( ) -> save ( $ meta ) ; } // Update cached relationship, if necessary. if ( $ this -> relationLoaded ( 'meta' ) ) { $ this -> meta [ $ key ] = $ meta ; } }
Add or update the value of the `Meta` at a given key.

@param string $key
@param mixed  $value
Add or update the value of the Meta at a given key .