acacha/names

There is no license information available for the latest version (0.2.1) of this package.

Provides alternative names to Laravel models.

0.2.1 2016-11-27 07:25 UTC

This package is auto-updated.

Last update: 2024-10-13 03:50:27 UTC


README

Provides alternatives names to Laravel 5 models.

Installation

composer require acacha/names

Migrations

Run:

php artisan migrate

To add names table to you Laravel project. Is not necessary to modify existent Model tables to add alternatives names to an existing model.

Use

Basically this package uses Laravel polymorphic-relations (1) to add alternative names to models.

You only have to add trait Acacha\Names\Nameable to you model:

class MyModel extends Model {
    use Nameable;    
    ...
}

This will add polimorphic relation names() that gives access to alternative model names:

mymodel->names();

Specifications

Table names

Columns:

  • id
  • shortname: Model/resource short name.
  • fullname: resource fullname.
  • nickname: resource nickname.
  • code: resource code.
  • description: resource description.
  • notes: resource notes.
  • nameable_type : nameable object class
  • nameable_id: nameable object id