Download the PHP package hamedov/laravel-taxonomies without Composer
On this page you can find all versions of the php package hamedov/laravel-taxonomies. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hamedov/laravel-taxonomies
More information about hamedov/laravel-taxonomies
Files in hamedov/laravel-taxonomies
Package laravel-taxonomies
Short Description Assign categories, tags, etc, to eloquent models.
License MIT
Informations about the package laravel-taxonomies
Laravel taxonomies
Assign categories, tags, types, etc to your models or any taxonomy that can be used to classify models.
Installation
Publish config file
Create taxonomies
Assign image icons to taxonomies
- The package uses spatie/laravel-medialibrary to allow you to assign image icons to taxonomies.
- You can configure icons collection name and icon conversions in the config file, you can define as many conversions as you like.
-
The icon collection is a single file collection.
-
Assign an image to taxonomy
- Refer to Media library documentation for more info.
Translate taxonomies
- You can also set translations for the
title
anddescription
columns using spatie/laravel-translatable package. - You database server must support json columns for translations to work.
- Refer to https://github.com/spatie/laravel-translatable for more information on how to translate these fields.
Manage model taxonomies
-
To be able to assign taxonomies to any of your models, the model must use the
HasTaxonomies
trait. -
Assign taxonomies to models
-
Available scopes
// We can only get one type of taxable models at once // This is a limitation of many to many polymorphic relationships $taxonomy = Taxonomy::find(1); $taxonomy_posts = $taxonomy->taxables('App\Post')->get(); $taxonomy_products = $taxonomy->taxables('App\Product')->get();
// To get all models at once, we can do something like this $taxonomy->load('taxes', 'taxes.taxable'); foreach($taxonomy->taxes as $tax) { // $tax->taxable here is the post or product or any thing else. dd($tax->taxable); }
$taxonomy = Taxonomy::find(1); $pivot_entries = $taxonomy->taxes()->where([ // Filter by taxonomy_id, taxable_id, taxable_type ])->get();
- You can also do the same from other model perspective
License
Released under the Mit license, see LICENSE
All versions of laravel-taxonomies with dependencies
illuminate/database Version ^10.0
illuminate/support Version ^10.0
spatie/laravel-medialibrary Version ^10.0.0
spatie/laravel-sluggable Version ^3.5
spatie/laravel-translatable Version ^6.5
staudenmeir/laravel-adjacency-list Version ^1.13