PHP code example of paulhenri-l / laravel-has-meta

1. Go to this page and download the library: Download paulhenri-l/laravel-has-meta 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/ */

    

paulhenri-l / laravel-has-meta example snippets


Schema::create('users', function ($table) {
    $table->bigIncrements('id');
    $table->json('meta');
    $table->timestamps();
});



namespace PaulhenriL\LaravelHasMeta\Tests\Fakes;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use \PaulhenriL\LaravelHasMeta\HasMeta;
}

$user = new User();

// Set
$user->setMeta('preferences.time_zone', 'Europe/Paris');
$user->setEncryptedMeta('health.has_diabet', true);

// Get
$user->getMeta('preferences.time_zone');
$user->getEncryptedMeta('health.has_diabet');