PHPackages                             robotsinside/laravel-categories - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. robotsinside/laravel-categories

ActiveLibrary

robotsinside/laravel-categories
===============================

A package for categorising Laravel Eloquent models.

1.2.1(3y ago)38221MITPHPPHP ^7.3|^8.0

Since Sep 19Pushed 3y agoCompare

[ Source](https://github.com/robotsinside/laravel-categories)[ Packagist](https://packagist.org/packages/robotsinside/laravel-categories)[ RSS](/packages/robotsinside-laravel-categories/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Laravel Categories
==================

[](#laravel-categories)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7027113ae18208efc4fc13eadaa40201082c2a3e1c47b0afbfb293d448d1fe11/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f626f7473696e736964652f6c61726176656c2d63617465676f726965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/robotsinside/laravel-categories)[![Total Downloads](https://camo.githubusercontent.com/3c37dd891d3ccf3f18822a9757353b1ac27f2acb7611d4f844fb496b15027a6a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f626f7473696e736964652f6c61726176656c2d63617465676f726965732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/robotsinside/laravel-categories)[![CI](https://github.com/robotsinside/laravel-categories/actions/workflows/laravel.yml/badge.svg?style=flat-square)](https://github.com/robotsinside/laravel-categories/actions/workflows/laravel.yml/badge.svg?style=flat-square)[![License: MIT](https://camo.githubusercontent.com/458425f8985b0b0c8a736cffe75e05a098e3d77906acddbcad2bfc54492a4e02/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)

A simple package for categorising Eloquent models in Laravel. This package is a sibling of [Laravel Tags](https://github.com/robotsinside/laravel-tags), which can be used to tag Eloquent models. The API is the same as this one.

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Scopes](#scopes)
- [Security](#security)
- [Credits](#credits)
- [Coffee Time](#coffee-time)
- [License](#license)

Installation
------------

[](#installation)

1. Install using Composer

```
composer require robotsinside/laravel-categories
```

2. Optionally register the service provider in `config/app.php`

```
/*
* Package Service Providers...
*/
\RobotsInside\Categories\CategoriesServiceProvider::class,
```

Auto-discovery is enabled, so this step can be skipped.

3. Publish the migrations

```
php artisan vendor:publish --provider="RobotsInside\Categories\CategoriesServiceProvider" --tag="migrations"
```

4. Migrate the database. This will create two new tables; `categories` and `categorisables`

```
php artisan migrate
```

Usage
-----

[](#usage)

Use the `RobotsInside\Categories\Categorisable` trait in your models.

```
