Skip to content

Commit 7f95874

Browse files
author
Pantea Marius-ciclistu
committed
1 parent 99c26f3 commit 7f95874

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Models/BaseModel.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,4 +488,25 @@ protected function initializeActiveRecordSegregationProperties(): void
488488
self::$activeRecordFqnSegregationPropertiesFqnsMap[$class][$property] = $classFqn;
489489
}
490490
}
491+
492+
/**
493+
* @inheritdoc
494+
* @throws \BadMethodCallException
495+
*/
496+
public function __call($method, $parameters)
497+
{
498+
if (\in_array(\strtolower($method), ['incrementeach', 'decrementeach'], true)) {
499+
/** \MacropaySolutions\MaravelRestWizard\Models\BaseModel::incrementBulk can be used instead */
500+
throw new \BadMethodCallException(\sprintf(
501+
'Call to unscoped method %s::%s(). Use $model->newQuery()->getQuery()->%s()' .
502+
' for unscoped or $model->newQuery()->%s() for scoped behavior.',
503+
static::class,
504+
$method,
505+
$method,
506+
$method,
507+
));
508+
}
509+
510+
return parent::__call($method, $parameters);
511+
}
491512
}

0 commit comments

Comments
 (0)