2017 © Pedro Peláez
 

library laravel-extendable

Traits for Laravel to add and manage custom Eloquent model fields.

image

ironshark/laravel-extendable

Traits for Laravel to add and manage custom Eloquent model fields.

  • Tuesday, July 12, 2016
  • by TUNER88
  • Repository
  • 10 Watchers
  • 22 Stars
  • 9,970 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

Laravel Extendable package

License Downloads Version-stable, (*1)

How to install

Composer Install

composer require ironshark/laravel-extendable

Laravel Service Provider

Add service provider in app/config/app.php, (*2)

'providers' => [
    IronShark\Extendable\ExtendableServiceProvider::class,
];

Publish configs, templates and run migrations., (*3)

php artisan vendor:publish --provider="IronShark\Extendable\ExtendableServiceProvider"
php artisan migrate

Usage

Add traits

Add model trait to models, where you want to use custom fields., (*4)

class Article extends \Illuminate\Database\Eloquent\Model {
    use IronShark\Extendable\ModelTrait;
}

Config fields

Use app/config/custom-fields.php to configure your fields., (*5)

return [
    'App\Room' => [                                                     // model name
        'light' => [                                                    // field name
            'title' => 'Light',                                         // field title (can be used in views)
            'type' => \IronShark\Extendable\CustomFieldType::Radio,     // field type
            'options' => [                                              // possible values/labels
                0 => 'Off',
                1 => 'On'
            ],
            'default' => 1                                              // default value
        ]
    ]
];

Assign/retrieve customfield values

Assign custom field values as regular values., (*6)

$data = [
    'title' => 'Awesome Article!!!', // regular field
    'recomended' => 1                // custom filed     
];

$article = new Article();
$article->fill($data);
$article->save();

Retrieve custom field values., (*7)

$article = Article::find(1);
$article->recomended->value; // 1
echo $article->recomended;   // 1

Field types

FieldType DB DataType Example
CustomFieldType::String VARCHAR(255) Lorem
CustomFieldType::Text TEXT Lorem Ipsum...
CustomFieldType::Select VARCHAR(255) en_us
CustomFieldType::Radio VARCHAR(255) off
CustomFieldType::Checkbox VARCHAR(255) 0
CustomFieldType::DateTime TIMESTAMP 2015-01-19 03:14:07

The Versions

12/07 2016

dev-master

9999999-dev

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

12/07 2016

dev-develop

dev-develop

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

12/07 2016

v1.0.10

1.0.10.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

27/06 2016

v1.0.9

1.0.9.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

27/06 2016

v1.0.8

1.0.8.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

10/09 2015

v1.0.7

1.0.7.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

10/09 2015

v1.0.6

1.0.6.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

31/07 2015

v1.0.5

1.0.5.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

31/07 2015

v1.0.4

1.0.4.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

31/07 2015

dev-hotfix/1.0.4

dev-hotfix/1.0.4

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

31/07 2015

v1.0.3

1.0.3.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

30/07 2015

v1.0.2

1.0.2.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

30/07 2015

v0.0.1

0.0.1.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

30/07 2015

v1.0.0

1.0.0.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

30/07 2015

v1.0.1

1.0.1.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable

24/07 2015

v0.0.0

0.0.0.0

Traits for Laravel to add and manage custom Eloquent model fields.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel eloquent trait custom fields extendable