hwavina/hwa-meta

Laravel package meta data

v1.0.0 2021-10-17 16:48 UTC

This package is auto-updated.

Last update: 2024-04-17 22:21:25 UTC


README

68747470733a2f2f68776176696e612e6d652f77702d636f6e74656e742f75706c6f6164732f323032312f30392f6c6f676f2e706e67

Total Downloads Latest Stable Version License

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

  1. You can install the package via composer:
composer require hwavina/hwa-meta
  1. 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,
);
  1. You can customize the config/hwa_meta.php config file . If you customize file config/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.

  1. 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.

  1. Add allow type to config/hwa_meta.php
'allow_type' => [
    .....
    'customer' => ['id', 'customer_id'],
],
  1. You need to run the command below to clear cache and update the changes.
php artisan config:cache

# or

php artisan optimize:clear
  1. 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 hwavina@gmail.com. All security vulnerabilities will be promptly addressed.

Credits

License

The Laravel framework is open-sourced software licensed under the MIT license.