@param Model $model

@return bool
769591
public function liked(Model $model): bool
    {
        return (bool) $this->likes()
                           ->where('liked_by_id', $model->id)
                           ->where('liked_by_type', get_class($model))
                           ->count();
    }
34704
public static function clearCache($model = null)
    {
        if (is_null($model)) {
            static::$_cache = [];
        } elseif (isset(static::$_cache[$model])) {
            static::$_cache[$model] = [];
        }

        return true;
    }
649486
public function slugExists(Model $model, $slug) {
        return (bool) $model->find('count', array(
            'conditions' => array($this->settings[$model->alias]['slug'] => $slug),
            'recursive' => -1,
            'contain' => false
        ));
    }
452226
protected function isColumnTranslated(Model $model, $column)
    {
        $info = $this->getModelInformation($model);

        if ($info) {
            return (    $info->translated
                    &&  array_key_exists($column, $info->attributes)
                    &&  $info->attributes[$column]->translated
                    );
        }

        // Determine based on model itself
        if ( ! $this->hasTranslatableTrait($model)) return false;

        /** @var Translatable $model */
        return $model->isTranslationAttribute($column);
    }
481453
public function setModel(Model $model)
    {
        $this->model = $model;
        $this->fm = $this->model->loadFunctionMap();
    }
530209
public function push(Model $model): bool
    {
        if ($this->has($model)) {
            return $this->get($model);
        }

        return (bool) $this->model->collections()->save(
            new Collection([
                'item_id'         => $model->id,
                'item_type'       => get_class($model),
                'collection_name' => $this->collectionName,
            ])
        );
    }
510194
final protected function hasSubModel($model)
    {
        if (array_key_exists($model, $this->validSubModels)) {
            return (bool)is_file($this->validSubModels[ $model ]);
        }

        return false;
    }
793767
public function isOwner(Model $Model) {
		if (!$Model->exists()) {
			return false;
		}

		if (!$owner = Hash::get($Model->data, $Model->alias . '.' . $this->settings[$Model->alias]['owner']['path'])) {
			$requireAuth = $Model->requireAuth;
			$Model->requireAuth = false;
			$owner = $Model->field(
				$this->settings[$Model->alias]['owner']['path'],
				array($Model->alias . '.' . $Model->primaryKey => $Model->getID())
			);
			$Model->requireAuth = $requireAuth;
		}

		return $this->getCurrentUser($Model, $this->settings[$Model->alias]['owner']['auth']) == $owner;
	}
789625
public function saveEntity(Model $model)
    {
        $cacheKey = $this->cacheKey($model->toArray());
        $this->cache->forget($cacheKey);
        return $model->save();
    }
904326
protected function isAutoGenerated(Model $model, $key)
    {
        if ($key == $model->getKeyName() && $model->getIncrementing()) {
            return true;
        }

        $constants = (new ReflectionClass($model))->getConstants();

        if (in_array($key, [$constants['CREATED_AT'], $constants['UPDATED_AT']]) && $model->usesTimestamps()) {
            return true;
        }

        if (!method_exists($model, 'getDeletedAtColumn')) {
            return false;
        }

        return $key == $model->getDeletedAtColumn();
    }
568530
public function onSave(Model $model)
    {
        $data            = $this->queryAttributes($model);
        $fieldData       = FieldData::query()->firstOrCreate($data);
        $fieldData->data = input($this->getName());
        return $fieldData->save();
    }
18065
public function afterDelete(Model $model) {
        if ($this->settings[$model->alias]['events']['onDelete']) {
            $this->resetCache($model, $model->id);
        }

        return true;
    }
977038
public function existsAndNotDeleted(Model $model, $id) {
		if ($id === null) {
			$id = $model->getID();
		}
		if ($id === false) {
			return false;
		}
		$exists = $model->find('count', array('conditions' => array($model->alias . '.' . $model->primaryKey => $id)));
		return ($exists ? true : false);
	}
703865
public function delete(Model $model, $user = null)
    {
        if (! $this->isEnabled()) {
            return false;
        }

        $activity = $this->initActivity();

        // Auto determine user if none is supplied
        $user = $this->getUserId($user);

        $data = [
            'user_id'      => $user,
            'subject_id'   => $model->getKey(),
            'subject_type' => get_class($model)
        ];

        $activity->where($data)->delete();
    }
916219
public function afterValidate(Model $model) {
        if ($this->settings[$model->alias]['resetAfter']) {
            $model->validate = array();
        }

        return true;
    }
1118071
public function creating(Model $model)
    {
        if (request()->hasFile('name')) {
            // delete prev image
            $file = $this->fileUploader->handle(request()->file('name'));
            $model->name = $file['filename'];
            $model->fill(Arr::except($file, 'filename'));
        } else {
            if ($model->type !== 'f') {
                return false;
            }
        }
    }
1256498
public function process(Model $model)
    {
        $data = $model->getData() ? 'TRUE' : 'FALSE';
        return $this->pool->render->renderSingleChild(
            $model->setData($data)
                ->setNormal($data)
                ->setType(static::TYPE_BOOL)
        );
    }