This package was created by, and is maintained by Brian Faust, and provides categories for Laravel Eloquent Models.
composer require konceiver/laravel-categories
Check lazychaser/laravel-nestedset to learn how to create, update, delete, etc. categories.
<?php
namespace App;
use Konceiver\Categories\Concerns\HasCategories;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasCategories;
}
$post->categoriesList();
$post->syncCategories([Category::find(1), Category::find(2), Category::find(3)]);
$post->syncCategories([]);
$post->syncCategories([Category::find(1), Category::find(3)]);
$post->assignCategory(Category::find(1));
$post->removeCategory(Category::find(1));
Category::first()->entries(Post::class)->get();
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover a security vulnerability within this package, please send an e-mail to hello@konceiver.dev. All security vulnerabilities will be promptly addressed.
This project exists thanks to all the people who contribute.
We invest a lot of resources into creating and maintaining our packages. You can support us and the development through GitHub Sponsors.
Laravel Categories is an open-sourced software licensed under the MPL-2.0.