About
hwa-meta is a meta package. It helps us to build and develop faster with pre-built functions. This saves a lot of time on future projects.
We share this package to give programmers an extra useful library. We hope people use this package not for commercialization or profit of any kind.
And finally, hope to receive more contributions and shares from all of you.
Thank you very much
Install
- You can install the package via composer:
composer require hwavina/hwa-meta
- Optional: The service provider will automatically get registered. Or you may manually add the service provider in your
config/app.php
file:
'providers' => array(
// ...
Hwavina\HwaMeta\HwaMetaServiceProvider::class,
);
- You can customize the
config/hwa_meta.php
config file . If you customize fileconfig/hwa_meta.php
. You need to run the command below to clear cache and update the changes.
php artisan config:cache
# or
php artisan optimize:clear
Default config file contents
You can view the default config file contents at:
https://github.com/hwavina/hwa-meta/blob/main/config/hwa_meta.php
Usage
MetaTools
This tool helps you to easily manage the extended data fields of certain objects.
- Create Meta Class with command.
Example: We need CustomerMeta. This tools help us make model file and migration file.
php artisan hwa:make:meta Customer -m
The above command we have added -m to create the migration file.
- Add allow type to
config/hwa_meta.php
'allow_type' => [
.....
'customer' => ['id', 'customer_id'],
],
- You need to run the command below to clear cache and update the changes.
php artisan config:cache
# or
php artisan optimize:clear
- Run command to migrate the meta migration file to database
php artisan migrate
After completing the above configuration steps you can use the methods available in the meta model in the classes you want.
// Example
CustomerMeta:_update(1, 'gender', 'male'); // update or add new gender for customer has id is 1
Beside the functions and methods we have built, people can also build their own by inheriting our classes.
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover a security vulnerability within hwa-meta, please send an e-mail to Phi Hoang via [email protected]. All security vulnerabilities will be promptly addressed.
Credits
License
The Laravel framework is open-sourced software licensed under the MIT license.