classes/Models/Traits/Encodable.php
public function encode($attribute, $preset)
    {
        $encoding = new Encoding([
            'encodable_attribute' => $attribute,
            'preset' => $preset,
        ]);

        $this->encodings()->save($encoding);

        return $encoding;
    }
public function encode($attribute, $preset)
    {
        $encoding = new Encoding([
            'encodable_attribute' => $attribute,
            'preset' => $preset,
        ]);

        $this->encodings()->save($encoding);

        return $encoding;
    }
public function encode ( $ attribute , $ preset ) { $ encoding = new Encoding ( [ 'encodable_attribute' => $ attribute , 'preset' => $ preset , ] ) ; $ this -> encodings ( ) -> save ( $ encoding ) ; return $ encoding ; }
Delete any existing encoding for the attribute and then encode from the
source.  The deleting happens automatically onCreating.

@param  string   $attribute The attribute on the model to use as source
@param  string   $preset    The output config key
@return Encoding The new output instance
Delete any existing encoding for the attribute and then encode from the source . The deleting happens automatically onCreating .