Causes revision for habtm associated models if that model does version control
on their relationship. BeforeDelete identifies the related models that will need
to do the revision update in afterDelete. Uses

@param unknown_type $Model
@return void
359988
public function afterDelete(Model $Model) {
		if ($this->settings[$Model->alias]['auto'] === false) {
			return;
		}
		if (!$Model->ShadowModel) {
			return;
		}
		if (isset($this->deleteUpdates[$Model->alias]) && !empty($this->deleteUpdates[$Model->alias])) {
			foreach ($this->deleteUpdates[$Model->alias] as $assocAlias => $assocIds) {
				$Model->{$assocAlias}->updateRevisions($assocIds);
			}
			unset($this->deleteUpdates[$Model->alias]);
		}
	}
525868
public function saved($model)
    {
        $translationRepository = \App::make(TranslationRepository::class);
        $cacheRepository       = \App::make('translation.cache.repository');
        foreach ($model->translatableAttributes() as $attribute) {
            // If the value of the translatable attribute has changed:
            if ($model->isDirty($attribute)) {
                $translationRepository->updateDefaultByCode($model->translationCodeFor($attribute), $model->getRawAttribute($attribute));
            }
        }
        $cacheRepository->flush(config('app.locale'), 'translatable', '*');
    }
1325904
public function updating(Eloquent $model)
    {
        $originalName = $model->getOriginal('name');
        $currentName  = $model->getAttribute('name');
        $deletedAt    = null;

        if ($model->isSoftDeleting()) {
            $deletedAt = $model->getDeletedAtColumn();
        }

        $isRestoring = function ($model, $deletedAt) {
            return (! is_null($deletedAt)
                && is_null($model->getAttribute($deletedAt))
                && ! is_null($model->getOriginal($deletedAt)));
        };

        if ($isRestoring($model, $deletedAt)) {
            $this->acl->addRole($currentName);
        } else {
            $this->acl->renameRole($originalName, $currentName);
        }
    }
247548
public function delete(Model $model)
    {
        $deleted = $model->delete();

        if ($deleted) {
            app('cache')->flush();
        }

        return $deleted;
    }
1085394
public function delete(AbstractModel $model)
    {

        list($query, $param, $type) = $this->queryBuilder->generateDeleteForModel($model);

        if ($this->modelCache->get($model)) {
            $this->modelCache->remove($model);
        }
        
        $stmt = $this->prepare($query, $param);

        if ($stmt->execute()) {
            return true;

        } else {
            $this->log(ILog::T_ERROR, print_r($stmt->errorInfo(), true));
            return false;
        }
    }
1213748
public function flush($model)
    {
        if (! $this->shouldMaintainIndex($model)) {
            return;
        }

        $indexColumn = $this->getIndexColumn($model);

        $this->database
            ->table($model->searchableAs())
            ->update([$indexColumn => null]);
    }
574586
protected function deleteModel(Model $model)
    {
        $strategy = $this->getModelInformation()->deleteStrategy();

        if ( ! $strategy) {
            return $model->delete();
        }

        /** @var DeleteStrategyFactoryInterface $factory */
        $factory = app(DeleteStrategyFactoryInterface::class);
        $strategy = $factory->make($strategy);

        return $strategy->delete($model);
    }
112538
public function deleting($model)
    {
        foreach ($this->relations as $relation) {
            if ($model->{$relation}()->count() > 0) {
                // Returning false from an Eloquent event listener will cancel the operation.
                return false;
            }
        }
    }
783224
public function handle($model)
    {
        if (! $model -> isUserstamping()) {
            return;
        }

        if (is_null($model -> {$model -> getDeletedByColumn()})) {
            $model -> {$model -> getDeletedByColumn()} = auth() -> id();
        }

        $dispatcher = $model -> getEventDispatcher();

        $model -> unsetEventDispatcher();

        $model -> save();

        $model -> setEventDispatcher($dispatcher);
    }
1107932
public function beforeInsert($model, &$data)
    {
        if ($this->weak) {
            return;
        }

        // The value for the master_field is set, so we are going to use existing record anyway
        if ($model->hasField($this->master_field) && $model[$this->master_field]) {
            return;
        }

        $insert = $this->dsql();
        $insert->mode('insert');
        $insert->set($model->persistence->typecastSaveRow($model, $this->save_buffer));
        $this->save_buffer = [];
        $insert->set($this->foreign_field, null);
        $insert->insert();
        $this->id = $this->owner->lastInsertID();

        if ($this->join) {
            $this->join->set($this->master_field, $this->id);
        } else {
            $data[$this->master_field] = $this->id;
        }
    }
1129534
public function clearCache(Model $model) {
        if ($this->_cached) {
            foreach ($this->_cached as $key => $value) {
                $this->deleteCache($model, $key);
            }
        }

        return Cache::clear(false, $this->settings[$model->alias]['cacheConfig']);
    }
467451
protected function setForeignAttributesForCreate(Model $model)
    {
        $model->{$this->getForeignKeyName()} = $this->getParentKey();

        $model->{$this->getMorphType()} = $this->morphClass;
    }
34704
public static function clearCache($model = null)
    {
        if (is_null($model)) {
            static::$_cache = [];
        } elseif (isset(static::$_cache[$model])) {
            static::$_cache[$model] = [];
        }

        return true;
    }
980614
public function model_call_restore_delete(Jam_Model $model)
	{
		Jam::update($this->_model)
			->where_key($model->id())
			->deleted(Jam_Behavior_Paranoid::DELETED)
			->value($this->_field, FALSE)
			->execute();
	}
122288
public function remove(DomainModel $model)
    {
        $this->getEntityManager()->remove($model);
        $this->getEntityManager()->flush();
    }
1354349
public static function deleteModel($model)
    {
        foreach(AnnotationManager::getPropertiesAnnotations(BeanFactory::getObjectClass($model), RelationBase::class) as $propertyName => $annotations)
        {
            if(null === $model[$propertyName])
            {
                continue;
            }
            $annotation = $annotations[0];
            Delete::parse($model, $propertyName, $annotation);
        }
    }
627720
public function deleteModel($model)
    {
        // first remove any automatically created models
        /** @var $relationField ManyToManyField */
        foreach ($model->getMeta()->localManyToMany as $name => $relationField) {
            if ($relationField->relation->through->getMeta()->autoCreated) {
                $this->deleteModel($relationField->relation->through);
            }
        }
        $this->dropTable($model->getMeta()->getDbTable());
    }