PHP code example of seyedmr / laralight-metadata

1. Go to this page and download the library: Download seyedmr/laralight-metadata 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/ */

    

seyedmr / laralight-metadata example snippets


namespace App;

...
use Illuminate\Database\Eloquent\Model;
use SeyedMR\LaraliteMetadata\Traits\HasMeta;

class User extends Model
{
    use HasMeta;
    
    ...
}

$user = User::find(1);
$user->setMeta('meta-key','meta-value');

$user = User::find(1);
$user->getMeta('meta-key');