Multi Level Category Hierarchy.
Switch branches/tags
Nothing to show
Latest commit bd183d7 Apr 4, 2014 @teepluss Merge pull request #5 from johnlui/master
bug fix
Failed to load latest commit information.
src [DONE] bug fix on database prefix Apr 3, 2014
tests change donation btn Oct 31, 2013
.gitignore Categorize Sep 6, 2013
.travis.yml Categorize Sep 6, 2013
LICENSE Categorize Sep 6, 2013 fix doc Nov 26, 2013
composer.json update composer.json Nov 1, 2013
phpunit.xml Categorize Sep 6, 2013

Multi Level Category.

Categorize is a category management for Laravel 4.


To get the lastest version of Theme simply require it in your composer.json file.

"teepluss/categorize": "dev-master"

You'll then need to run composer install to download it and have the autoloader updated.

Once Attach is installed you need to register the service provider with the application. Open up app/config/app.php and find the providers key.

'providers' => array(



Publish config using artisan CLI.

php artisan config:publish teepluss/categorize

Migrate tables.

php artisan migrate --package=teepluss/categorize


Creating category as a root.

$categorize = Categorize::prepare(array(
    'type'        => 'Product',
    'title'       => 'Hardware',
    'description' => 'Hardware is a ...'


Creating category as a child of parent.

$categorize = Categorize::prepare(array(
    'type'        => 'Product',
    'title'       => 'Hardware - CPU',
    'description' => 'CPU is a ...'

$parent = Categorize::getCategoryProvider()->findById(1);
// or
// $parent = Categorize::getCategoryProvider()->findByName('Hardware');


Moving to a new root.

$category = Categorize::getCategoryProvider()->findByName('Hardware - CPU');


Moving to another parent.

$category = Categorize::getCategoryProvider()->findByName('Hardware - CPU');

$parent = Categorize::getCategoryProvider()->findByName('Software');


Update information.

$category = Categorize::getCategoryProvider()->findByName('Hardware - CPU');
    'title'       => 'Software - Office',
    'description' => 'Documenting'


Delete with children.

$category = Categorize::getCategoryProvider()->findByName('Hardware');


List category as tree.

$category = Categorize::getCategoryProvider()->findByName('Hardware');


Build categories as tree.

$categories = Categorize::getCategoryProvider()->whereType('Blog')->get();

// Build only root categories.

$categories = Categorize::getCategoryProvider()->root()->whereType('Blog')->get();


Using categorize with model.

Define relation to model

public function categories()
    return $this->morphMany('Teepluss\Categorize\CategoryRelates\Relate', 'contentable');

Push content to a category.

$category = Categorize::getCategoryProvider()->findByName('Hardware - CPU');

$blog = Blog::find(24);
$blog->categories()->create(array('category_id' => $category->id));

List contents that belongs to a category.

$contentIds = Categorize::getCategoryProvider()->findById(1)->relates()->whereContentableType('Blog')->lists('contentable_id');
// or
// $contentIds = Categorize::getCategoryRelateProvider()->whereContentableType('Blog')->whereCategoryId(1)->lists('contentable_id');

$blogs = Blog::find($contentIds);


Support or Contact

If you have some problem, Contact

Support via PayPal