PHP code example of augustpermana / laravel-meta-generator
1. Go to this page and download the library: Download augustpermana/laravel-meta-generator 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/ */
augustpermana / laravel-meta-generator example snippets
'providers' => [
// Other Service Providers
August\MetaGenerator\ServiceProvider::class,
],
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use AugustPermana\MetaGenerator\Traits\HasMetadata;
class Book extends Model
{
use HasMetadata;
}
// Retrieve models with any value for the "author" metadata
$models = Model::whereHasMeta('author')->get();
// Retrieve models with a specific "author" value
$models = Model::whereHasMeta('author', 'John Doe')->get();