khaway / laravel-taxonomy
There is no license information available for the latest version (v0.0.18) of this package.
Laravel taxonomy package.
v0.0.18
2020-09-18 00:39 UTC
Requires
- php: ^7.4
- ankurk91/laravel-eloquent-relationships: ^1.1
- kalnoy/nestedset: ^5.0
- nanigans/single-table-inheritance: 0.8.*
- spatie/data-transfer-object: ^2.3
- spatie/eloquent-sortable: ^3.8
- spatie/laravel-schemaless-attributes: ^1.7
- spatie/laravel-translatable: ^4.4
Requires (Dev)
- orchestra/testbench: ^4.0|^5.0
- phpunit/phpunit: ^9.1
- roave/security-advisories: dev-master
- spatie/phpunit-watcher: ^1.22
README
Inspired by power of WordPress taxonomies, for Laravel Artisans.
<?php use Scrapify\LaravelTaxonomy\Models\Taxonomies\NestedTaxonomy; use Scrapify\LaravelTaxonomy\InteractsWithTaxonomies; class ProductCategory extends NestedTaxonomy { public static $singleTableType = 'product_category'; } class Product { use InteractsWithTaxonomies; public function categories() { return $this->morphToManyTaxonomies(ProductCategory::class); } } $productCategory = ProductCategory::create(['Notebooks']); Product::create(['name' => 'Apple MacBook']) ->categories() ->sync($productCategory->id);