diff --git a/src/Traits/Bannable.php b/src/Traits/Bannable.php index dd7c3f1..6dbc0fb 100644 --- a/src/Traits/Bannable.php +++ b/src/Traits/Bannable.php @@ -69,4 +69,18 @@ public function scopeWhereBansMeta(Builder $query, string $key, $value): void $query->where('metas->'.$key, $value)->notExpired(); }); } + + /** + * + * @param Builder $query + * @param string $className + * @return void + */ + public function scopeBannedByType(Builder $query, string $className) : void + { + $query->whereHas('bans', function ($query) use ($className) { + $query->where('created_by_type', $className)->notExpired(); + }); + } + }