$this->saveRelationshipsUsing(static function (SpatieTagsInput $component, ?Model $record, array $state) {
if (! (method_exists($record, 'syncTagsWithType') && method_exists($record, 'syncTags'))) {
return;
}
if ($type = $component->getType() && ! $component->isAnyTagTypeAllowed()) {
$record->syncTagsWithType($state, $type);
return;
}
$component->syncTagsWithAnyType($record, $state);
});
$this->saveRelationshipsUsing(static function (SpatieTagsInput $component, ?Model $record, array $state) {
if (! (method_exists($record, 'syncTagsWithType') && method_exists($record, 'syncTags'))) {
return;
}
if ($type = $component->getType() && ! $component->isAnyTagTypeAllowed()) {
$record->syncTagsWithType($state, $type);
return;
}
$component->syncTagsWithAnyType($record, $state);
});