2017 © Pedro Peláez
 

asgard-module attribute-module

image

laraplug/attribute-module

  • Friday, June 1, 2018
  • by darron1217
  • Repository
  • 2 Watchers
  • 1 Stars
  • 43 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 105 % Grown

The README.md

Latest Stable Version Software License Daily Downloads Monthly Downloads Total Downloads PHP7 Compatible, (*1)

Laraplug Attribute

Laraplug Attribute is a EAV e-commerce module, built on top of AsgardCMS platform., (*2)

Successfully implemented on laraplug/product-module, (*3)

Table Of Contents

Installation

  1. Install the package via composer:, (*4)

    composer require laraplug/attribute-module
    
  2. Execute migrations via AsgardCMS's module command:, (*5)

    php artisan module:migrate Attribute
    
  3. Execute publish via AsgardCMS's module command:, (*6)

    php artisan module:publish Attribute
    
  4. Done!, (*7)

Usage

Add EAV to Eloquent model

To add EAV functionality to your Eloquent model, just use the \Module\Attribute\Traits\Attributable trait and implement \Module\Attribute\Contracts\AttributesInterfacelike this:, (*8)

use \Module\Attribute\Contracts\AttributesInterface
use \Module\Attribute\Traits\Attributable

class Book extends Model implements AttributesInterface
{
    use Attributable;
}

Configure attributes on Eloquent model

Add $systemAttributes on your entity to add attributes on code-level:, (*9)

use \Module\Attribute\Contracts\AttributesInterface
use \Module\Attribute\Traits\Attributable

class Book extends Model implements AttributesInterface
{
    use Attributable;
    ...

    // Set systemAttributes to define EAV attributes
    protected $systemAttributes = [
        'isbn' => [
            'type' => 'input'
        ],
        'media' => [
            'type' => 'checkbox',
            'options' => [
                'audio-cd',
                'audio-book',
                'e-book',
            ]
        ]
    ];
}

Available SystemAttributes Parameters

type : String of input type (list below) - input : input[type=text] - textarea : teaxarea - radio : input[type=radio] - checkbox : input[type=checkbox] - select : select - multiselect : select[multiple], (*10)

options : Array of option keys, (*11)

has_translatable_values : boolean, (*12)

About Laraplug

LaraPlug is a opensource e-commerce project built on top of AsgardCMS., (*13)

Contributing

We welcome any pull-requests or issues :), (*14)

The Versions

01/06 2018
05/04 2018

dev-polymorphic

dev-polymorphic

  Sources   Download

MIT

The Requires

 

The Development Requires

by Darron Park

09/03 2018

v0.3.1

0.3.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Darron Park

11/02 2018

v0.3.0

0.3.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Darron Park

01/02 2018

dev-beta

dev-beta

  Sources   Download

MIT

The Requires

 

The Development Requires

by Darron Park

01/02 2018

dev-stabilization

dev-stabilization

  Sources   Download

MIT

The Requires

 

The Development Requires

by Darron Park

01/02 2018

v0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Darron Park

30/01 2018

v0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Darron Park