• Stars
    star
    129
  • Rank 279,262 (Top 6 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Metadata for Eloquent model

Laravel Meta

Latest Version on Packagist Total Downloads Software License Build Status

Metadata for your Eloquent model

Installation

You can install the package via composer:

composer require appstract/laravel-meta

Publish, migrate

By running php artisan vendor:publish --provider="Appstract\Meta\MetaServiceProvider" in your project all files for this package will be published. For this package, it's only a migration. Run php artisan migrate to migrate the table. There will now be a table named metas in your database.

Usage

You can easily add Meta to an Eloquent model. Just add this to your model:

use Appstract\Meta\Metable;

class Book extends Model
{
    use Metable;
}

Then you can get, add, update and delete meta to the model.

$book = Book::find(1);

$book->addMeta('someKey', 'someValue');

$book->getMeta('someKey');

$book->getMetaValue('someKey');

$book->hasMeta('someKey');

$book->updateMeta('someKey', 'anotherValue');

$book->addOrUpdateMeta('someKey', 'someValue');

$book->deleteMeta('someKey');

$book->getAllMeta();

$book->deleteAllMeta();

Testing

$ composer test

Contributing

Contributions are welcome, thanks to y'all :)

About Appstract

Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon.

License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

laravel-opcache

Laravel Package for OPcache
PHP
1,327
star
2

laravel-blade-directives

A collection of nice Laravel Blade directives
PHP
858
star
3

laravel-options

Global key-value store in the database
PHP
722
star
4

laravel-stock

Keep stock for Eloquent models
PHP
287
star
5

laravel-multisite

Multiple sites on one codebase
PHP
216
star
6

laravel-bootstrap-components

Bootstrap components as Laravel components
HTML
192
star
7

laravel-tracer

Shows the path of each blade file loaded in a template
PHP
98
star
8

nova-horizon

Horizon statistics in Nova
Vue
79
star
9

lush-http

Smart Http Client for PHP
PHP
63
star
10

dd.js

Laravel dd() in JS
JavaScript
53
star
11

laravel-elixir-env

Use .env variables in Javascript with Laravel Elixir
JavaScript
39
star
12

laravel-response-macros

Extra response macro's for Laravel
PHP
33
star
13

laravel-referer-redirector

Manage redirects based on referers
PHP
32
star
14

nova-opcache

OPcache Tool for Laravel Nova
Vue
19
star
15

php-hostsfile

Read & Write HostsFile Entries with PHP
PHP
13
star
16

laravel-artisan-scan

[WIP] Scan for multiple improvement points
PHP
11
star
17

laravel-crawl-render

Pre-render Javascript sites for web crawlers
PHP
11
star
18

laravel-dusk-safari

Run Dusk tests in Safari
PHP
11
star
19

skeleton-php

Skeleton for PHP packages
PHP
11
star
20

vue-validate

[DEPRECATED] Input validation for Vue
JavaScript
10
star
21

laravel-moneybird

Laravel package for Moneybird
PHP
9
star
22

laravel-dusk-opera

Run Dusk tests in Opera
PHP
8
star
23

nova-signature-field

Signature Pad as a Nova Field
Vue
7
star
24

pakketpartner-php-client

PHP Client for the Pakketpartner API
PHP
7
star
25

laravel-pakketpartner

Wrapper for the Pakketpartner PHP Client
PHP
4
star
26

laravel-bol-retailer

Wrapper package for Bol.com Retailer API
PHP
2
star
27

laravel-twikey

PHP
2
star