2017 © Pedro Peláez
 

library category

Category table (POSTGRESQL ONLY)

image

raymondidema/category

Category table (POSTGRESQL ONLY)

  • Tuesday, January 7, 2014
  • by raymond.idema
  • Repository
  • 1 Watchers
  • 3 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Category

Category Table (Recursive) (PostgreSQL only), (*1)

Installation

 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, (*2)

Config

 ./app/config/app.php

 'providers' => array( 'Raymondidema\Category\CategoryServiceProvider' );
 'aliases' => array( 'Menustructure' => 'Raymondidema\Category\Facades\Category' );

Children

 Menustructure::table('categories')
                ->children($id)
                ->depth(3)
                ->get();

Optional components

Required, (*3)

table($table), children($id), childrenWithRoot($id), decendants($id), decendantsWithRoot($id), ancestors($id), breadcrumb($id), get(array('*')), (*4)

Optional, (*5)

depth($integer), where($column, $option), orderBy($column, $ascOrDesc), remember($minutes = null), (*6)

Descendants

 Menustructure::table('categories')
                ->decendants($id)
                ->depth(2)
                ->where('name', 'aspire')
                ->get();

Ancestors

 Menustructure::table('categories')->ancestors($id)->get(array('name','slug'));

Database layout example

Category requires the following columns: id, parent_id, position, (*7)

 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();
    });

How to interact with a model

this is not required., (*8)

 <?php

 use \Raymondidema\Category\Models\Reloquent;

 class Category extends Reloquent
 {
    // do stuff here!!!
 }

The Versions

07/01 2014

dev-master

9999999-dev

Category table (POSTGRESQL ONLY)

  Sources   Download

MIT

The Requires

 

by Raymond Idema

laravel postgresql

07/01 2014

1.0.1

1.0.1.0

Category table (POSTGRESQL ONLY)

  Sources   Download

MIT

The Requires

 

by Raymond Idema

laravel postgresql

07/01 2014

dev-development

dev-development

Category table (POSTGRESQL ONLY)

  Sources   Download

MIT

The Requires

 

by Raymond Idema

laravel postgresql

07/01 2014

1.0.0

1.0.0.0

Category table (POSTGRESQL ONLY)

  Sources   Download

MIT

The Requires

 

by Raymond Idema

laravel postgresql