classes/Observers/ManyToManyChecklist.php
private function updateRelationship($model, $relationship)
    {
        // Make sure the relationship exists on the model.  This also prevents the
        // wrong model (who might also have an `saved` callback) from trying to have
        // this data saved on it
        if (!method_exists($model, $relationship)) {
            return;
        }

        // Strip all the "0"s from the input.  These exist because push checkboxes
        // is globally set for all of Decoy;
        $ids = request(self::PREFIX.$relationship);
        $ids = array_filter($ids, function ($id) {
            return $id > 0;
        });

        // Allow a single listener to transform the list of ids to, for instance,
        // add pivot data.
        $prefix = 'decoy::many-to-many-checklist.';
        if ($mutated = Event::until($prefix."syncing: $relationship", [$ids])) {
            $ids = $mutated;
        }

        // Attach just the ones mentioned in the input.  This blows away the
        // previous joins
        $model->$relationship()->sync($ids);

        // Fire completion event
        Event::fire($prefix."synced: $relationship");
    }
private function updateRelationship($model, $relationship)
    {
        // Make sure the relationship exists on the model.  This also prevents the
        // wrong model (who might also have an `saved` callback) from trying to have
        // this data saved on it
        if (!method_exists($model, $relationship)) {
            return;
        }

        // Strip all the "0"s from the input.  These exist because push checkboxes
        // is globally set for all of Decoy;
        $ids = request(self::PREFIX.$relationship);
        $ids = array_filter($ids, function ($id) {
            return $id > 0;
        });

        // Allow a single listener to transform the list of ids to, for instance,
        // add pivot data.
        $prefix = 'decoy::many-to-many-checklist.';
        if ($mutated = Event::until($prefix."syncing: $relationship", [$ids])) {
            $ids = $mutated;
        }

        // Attach just the ones mentioned in the input.  This blows away the
        // previous joins
        $model->$relationship()->sync($ids);

        // Fire completion event
        Event::fire($prefix."synced: $relationship");
    }
private function updateRelationship ( $ model , $ relationship ) { // Make sure the relationship exists on the model.  This also prevents the // wrong model (who might also have an `saved` callback) from trying to have // this data saved on it if ( ! method_exists ( $ model , $ relationship ) ) { return ; } // Strip all the "0"s from the input.  These exist because push checkboxes // is globally set for all of Decoy; $ ids = request ( self :: PREFIX . $ relationship ) ; $ ids = array_filter ( $ ids , function ( $ id ) { return $ id > 0 ; } ) ; // Allow a single listener to transform the list of ids to, for instance, // add pivot data. $ prefix = 'decoy::many-to-many-checklist.' ; if ( $ mutated = Event :: until ( $ prefix . "syncing: $relationship" , [ $ ids ] ) ) { $ ids = $ mutated ; } // Attach just the ones mentioned in the input.  This blows away the // previous joins $ model -> $ relationship ( ) -> sync ( $ ids ) ; // Fire completion event Event :: fire ( $ prefix . "synced: $relationship" ) ; }
Process a particular input instance

@param Bkwld\Decoy\Models\Base $model        A model instance
@param string                  $relationship The relationship name
Process a particular input instance