Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Taxonomies Laravel Package

myerscode/laravel-taxonomies

View on GitHub
Deep Wiki
Context7

Terms

Creating Terms

You can create a simple term using the add helper method on the Myerscode\Laravel\Taxonomies\Term model, and passing in a name.

Term::add('Foo');

A slug of the name will be created for you, however an alternative slug can be set by passing it in a data array.

Term::add(['slug' => 'bar', 'name' => 'Foo']);

Adding terms to a model

You can add a single term:

$model->addTerm('Foo');
$model->addTerm('Bar');
// $model would now have the tags Foo and Bar

You can add a multiple term:

$model->addTerms(['Hello', 'World']);
// $model would now have the tags  Hello and World

You can sync term:

$model->syncTerms('Foo');
// $model would now only have the tag Foo

$model->syncTerms(['Hello', 'World']);
// $model would now only have the tags Hello and World

You can remove terms:

$model->detachTerms(['Hello', 'World']);
$model->detachTerms('Foo');

Associating Terms to a Taxonomy

By default terms do not get added to a taxonomy, but you can associate a new term or move association of an existing term to any taxonomy.

$tag = Term::create('Foo');
$taxonomy->attachTerms($tag);
$anotherTaxonomy->attachTerms($tag);
$tag = Term::find('Foo');
$anotherTaxonomy->attachTerms($tag);

The $tag with name Foo is now associated to the $anotherTaxonomy.

Term Taxonomy

When you have a term object you can get all the information associated with it!

Call the taxonomy property and this an instance of Term or will be null if it has not been assigned to it.

$taxonomy = $term->taxonomy;
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package