classes/Observers/Encoding.php
public function onSaving($event, $payload)
    {
        list($model) = $payload;

        if (!$this->isEncodable($model)) {
            return;
        }

        foreach ($model->getDirtyEncodableAttributes() as $attribute) {

            // If the attribute has a value, encode the attribute
            if ($model->getAttribute($attribute)) {
                $model->encodeOnSave($attribute);
            }

            // Otherwise delete encoding references
            elseif ($encoding = $model->encoding($attribute)) {
                $encoding->delete();
            }
        }
    }
public function onSaving($event, $payload)
    {
        list($model) = $payload;

        if (!$this->isEncodable($model)) {
            return;
        }

        foreach ($model->getDirtyEncodableAttributes() as $attribute) {

            // If the attribute has a value, encode the attribute
            if ($model->getAttribute($attribute)) {
                $model->encodeOnSave($attribute);
            }

            // Otherwise delete encoding references
            elseif ($encoding = $model->encoding($attribute)) {
                $encoding->delete();
            }
        }
    }
public function onSaving ( $ event , $ payload ) { list ( $ model ) = $ payload ; if ( ! $ this -> isEncodable ( $ model ) ) { return ; } foreach ( $ model -> getDirtyEncodableAttributes ( ) as $ attribute ) { // If the attribute has a value, encode the attribute if ( $ model -> getAttribute ( $ attribute ) ) { $ model -> encodeOnSave ( $ attribute ) ; } // Otherwise delete encoding references elseif ( $ encoding = $ model -> encoding ( $ attribute ) ) { $ encoding -> delete ( ) ; } } }
Start a new encode if a new encodable file was uploaded

@param  string $event
@param  array $payload Contains:
- Bkwld\Decoy\Models\Base $model
@return void
Start a new encode if a new encodable file was uploaded