app/maguttiCms/Admin/Helpers/ModelReplicator.php
/**
     *  duplicate the cloneable relations
     * @param $clone
     */
duplicate the cloneable relations
@param $clone
duplicate the cloneable relations @param $clone
protected function cloneRelations($clone)
    {
        $cloneable_relations = collect($this->model->cloneable_relations);
        if ($cloneable_relations->isEmpty()) return;
        $this->uniqueFields = $this->getCloneExemptAttributes($this->model);
        foreach ($cloneable_relations as $relation_name) {
            if ($this->model->$relation_name) {
                $relation = call_user_func([$this->model, $relation_name]);
                if (is_a($relation, 'Illuminate\Database\Eloquent\Relations\BelongsToMany')) {
                    $this->duplicatePivotedRelation($relation, $relation_name, $clone);
                } else {
                    $this->duplicateDirectRelation($relation, $relation_name, $clone);
                }
            }
        }
    }
protected function cloneRelations ( $ clone ) { $ cloneable_relations = collect ( $ this -> model -> cloneable_relations ) ; if ( $ cloneable_relations -> isEmpty ( ) ) return ; $ this -> uniqueFields = $ this -> getCloneExemptAttributes ( $ this -> model ) ; foreach ( $ cloneable_relations as $ relation_name ) { if ( $ this -> model -> $ relation_name ) { $ relation = call_user_func ( [ $ this -> model , $ relation_name ] ) ; if ( is_a ( $ relation , 'Illuminate\Database\Eloquent\Relations\BelongsToMany' ) ) { $ this -> duplicatePivotedRelation ( $ relation , $ relation_name , $ clone ) ; } else { $ this -> duplicateDirectRelation ( $ relation , $ relation_name , $ clone ) ; } } } }
duplicate the cloneable relations
 @param $clone
duplicate the cloneable relations @param $clone