| Package Data | |
|---|---|
| Maintainer Username: | frasmage |
| Maintainer Contact: | sean@plankdesign.com (Sean Fraser) |
| Package Create Date: | 2017-01-16 |
| Package Last Update: | 2025-08-11 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-26 03:13:45 |
| Package Statistics | |
|---|---|
| Total Downloads: | 660,375 |
| Monthly Downloads: | 16,100 |
| Daily Downloads: | 159 |
| Total Stars: | 281 |
| Total Watchers: | 8 |
| Total Forks: | 42 |
| Total Open Issues: | 8 |
Laravel-Metable is a package for easily attaching arbitrary data to Eloquent models for Laravel 5.
Attach some metadata to an eloquent model
$post = Post::create($this->request->input());
$post->setMeta('color', 'blue');
Query the model by its metadata
$post = Post::whereMeta('color', 'blue');
Retrieve the metadata from a model
$value = $post->getMeta('color');
composer require plank/laravel-metable
config/app.php. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.'providers' => [
...
Plank\Metable\MetableServiceProvider::class,
...
];
config/metable.php) and migration file (database/migrations/####_##_##_######_create_metable_table.php) of the package using artisan.php artisan vendor:publish --provider="Plank\Metable\MetableServiceProvider"
php artisan migrate
Plank\Metable\Metable trait to any eloquent model class that you want to be able to attach metadata to.<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Plank\Metable\Metable;
class Post extends Model
{
use Metable;
//...
}
The full documentation is available on ReadTheDocs.
This package is released under the MIT license (MIT).
Plank is a web development agency based in Montreal, Canada.