PHP code example of plank / laravel-metable

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

    

plank / laravel-metable example snippets


$post = Post::create($this->request->input());
$post->setMeta('color', 'blue');

$post = Post::whereMeta('color', 'blue');

$value = $post->getMeta('color');

'providers' => [
    ...
    Plank\Metable\MetableServiceProvider::class,
    ...
];



namespace App;

use Illuminate\Database\Eloquent\Model;
use Plank\Metable\Metable;

class Post extends Model
{
    use Metable;

    //...
}
bash
php artisan vendor:publish --provider="Plank\Metable\MetableServiceProvider"
bash
php artisan migrate