spatie / laravel-tags

Add tags and taggable behaviour to your Laravel app
https://freek.dev/609-an-opinionated-tagging-package-for-laravel-apps
MIT License
1.61k stars 281 forks source link

Add the ability to configure a custom Taggables model class #470

Closed eggnaube closed 1 year ago

eggnaube commented 1 year ago

This change allows the use of an own taggables class. Thus, for example, events can be easily registered on the taggables.

freekmurze commented 1 year ago

Thanks!

gregpriday commented 1 year ago

I can submit a separate PR for this, but shouldn't we ensure some sort of backward compat with old config files to prevent issues like this https://github.com/spatie/laravel-tags/issues/472?

Something like this:

public function getPivotModelClassName(): string
{
    return config('tags.taggable.class_name', Illuminate\Database\Eloquent\Relations\MorphPivot::class);
}