Is there a way of adding a scope to the BelongsToMany fields, such that when you attach related models you can only do so from restricted options?
Example:
Post belongsToMany Tags (using Spatie/Laravel-Tags). Tags belongsToMany Posts.
Tags model has id, name, slug, type and timestamp properties.
On the Detail or Update views, I would like to be able to attach Tags to Post.
Using the default BelongsToMany field (or a third-party package) on the Post resource allows for me to add Tags to Post.
App\Nova\Post.php
public function fields(Request $request)
{
BelongsToMany::make('Tags'),
}
However, I would like to only be able to add Tags where type = 'Books' to this model.