PHP code example of arafatkn / laravel-meta

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

    

arafatkn / laravel-meta example snippets


Arafatkn\LaravelMeta\MetaServiceProvider::class,

use \Illuminate\Database\Eloquent\Model;
use \Arafatkn\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');
bash
php artisan vendor:publish --provider="Arafatkn\LaravelMeta\MetaServiceProvider"
bash
php artisan migrate