PHP code example of miladev / lara-meta

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

    

miladev / lara-meta example snippets


Miladev\LaravelMeta\MetaServiceProvider::class,

use \Illuminate\Database\Eloquent\Model;
use \Miladev\LaravelMeta\Metable;

class Post extends Model
{
    use Metable;
}

$post = Post::withMetas()->first();

$post = Post::first();
$post->metas;

$post = Post::first();
$post->saveMeta('meta_key_here', 'value_here');
$post->getMeta('meta_key_here', 'default_value');
$post->updateMeta('meta_key_here', 'value_here_new');
$post->deleteMeta('meta_key_here');
$post->findMeta('value_here');
bash
php artisan vendor:publish --provider="Miladev\LaravelMeta\MetaServiceProvider"
bash
php artisan migrate