Weave Code
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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle