From 8789bdafbce1e187685ea379f46ea2ae31bcf60f Mon Sep 17 00:00:00 2001 From: Aspirant Zhang Date: Sat, 3 May 2025 19:26:20 +0800 Subject: [PATCH] fix: prevent error when calling non-existent getTagClassName method --- .../src/Forms/Components/SpatieTagsInput.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/spatie-laravel-tags-plugin/src/Forms/Components/SpatieTagsInput.php b/packages/spatie-laravel-tags-plugin/src/Forms/Components/SpatieTagsInput.php index 3095328df9..ee7ce4cf73 100644 --- a/packages/spatie-laravel-tags-plugin/src/Forms/Components/SpatieTagsInput.php +++ b/packages/spatie-laravel-tags-plugin/src/Forms/Components/SpatieTagsInput.php @@ -100,7 +100,9 @@ class SpatieTagsInput extends TagsInput } $model = $this->getModel(); - $tagClass = $model ? $model::getTagClassName() : config('tags.tag_model', Tag::class); + $tagClass = $model && method_exists($model, 'getTagClassName') + ? $model::getTagClassName() + : config('tags.tag_model', Tag::class); $type = $this->getType(); $query = $tagClass::query();