Download the PHP package socoladaica/laravel-table-prefix without Composer
On this page you can find all versions of the php package socoladaica/laravel-table-prefix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download socoladaica/laravel-table-prefix
More information about socoladaica/laravel-table-prefix
Files in socoladaica/laravel-table-prefix
Package laravel-table-prefix
Short Description Allows you to use a table prefix with standard Laravel models
License MIT
Homepage https://github.com/socoladaica/laravel-table-prefix
Informations about the package laravel-table-prefix
Laravel Table Prefix
Allows you to use a table prefix with standard Laravel models.
Have inspiration from ideas [Proposal] Prefixed Eloquent Models
Installation
You can install the package via composer:
Usage
Using it inside a Post
model would look like this:
Using it inside a CategoryPost
pilot would look like this:
However, if someone were to use this approach and had many models with a prefix that had to be updated this could prove to be a pain. We can do better by creating another trait (this trait would theoretically exist in user-land code, not in the core), say something like BlogPrefix
:
The final model might look something like this:
The final pivot might look something like this:
After that you can using it inside a migration would look like this:
Testing
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Socola Dai ca
- All Contributors
License
The MIT License (MIT). Please see License File for more information.