acacha / names
Provides alternative names to Laravel models.
Installs: 1 775
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- laravel/framework: ^5.3
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