Package Data | |
---|---|
Maintainer Username: | raymond.idema |
Maintainer Contact: | raymond@design-code.nl (Raymond Idema) |
Package Create Date: | 2014-01-03 |
Package Last Update: | 2014-01-07 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:01:38 |
Package Statistics | |
---|---|
Total Downloads: | 40 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Category Table (Recursive) (PostgreSQL only)
composer.json
"require": {
"laravel/framework": "4.1.*",
"raymondidema/category": "dev-master"
},
After updating you could do composer update
or composer install
or alternatively composer require raymondidema/category
./app/config/app.php
'providers' => array( 'Raymondidema\Category\CategoryServiceProvider' );
'aliases' => array( 'Menustructure' => 'Raymondidema\Category\Facades\Category' );
Menustructure::table('categories')
->children($id)
->depth(3)
->get();
Required
table($table), children($id), childrenWithRoot($id), decendants($id), decendantsWithRoot($id), ancestors($id), breadcrumb($id), get(array('*'))
Optional
depth($integer), where($column, $option), orderBy($column, $ascOrDesc), remember($minutes = null)
Menustructure::table('categories')
->decendants($id)
->depth(2)
->where('name', 'aspire')
->get();
Menustructure::table('categories')->ancestors($id)->get(array('name','slug'));
Category requires the following columns: id, parent_id, position
Schema::create('categories', function(Blueprint $table)
{
$table->increments('id');
$table->integer('parent_id')->unsigned()->nullable();
$table->string('name');
$table->string('slug');
$table->integer('position')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
this is not required.
<?php
use \Raymondidema\Category\Models\Reloquent;
class Category extends Reloquent
{
// do stuff here!!!
}