PHP code example of digitalruby / meta-data

1. Go to this page and download the library: Download digitalruby/meta-data library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

digitalruby / meta-data example snippets


   use DigitalRuby\MetaData\HasMetaData;

   class YourModel extends Model {
       use HasMetaData;

       // Model content
   }
   

   $model->setMeta('key', 'value');
   

   $value = $model->getMeta('key');
   

   $allMeta = $model->getAllMeta();
   

   $model->deleteMeta('key');
   
bash
php artisan migrate