Skip to content

Meta Model ​

Key-value rows for settings and per-event bookkeeping.

See the fe_meta table for the rows in use. value is cast to an array, so store JSON-shaped data. Prefix your own meta_key with your plugin slug.

Class ​

  • Class: FluentEvent\App\Models\Meta
  • Table: {prefix}fe_meta
  • Primary key: id
  • Extends: Model
  • Source: fluent-event/app/Models/Meta.php

Attributes ​

ColumnTypeCastFillableDescription
idbigint(20) unsigned—No
object_typevarchar(50)—Yesoption, user, calendar or event.
object_idbigint(20) unsignedintYesThe object the row belongs to. NULL for options.
meta_keyvarchar(191)—YesThe key.
valuelongtextarrayYesJSON value.
created_attimestamp—No
updated_attimestamp—No

Constants ​

ConstantValueMeaning
Meta::OBJECT_TYPE_OPTION"option"Plugin-wide settings.
Meta::OBJECT_TYPE_USER"user"Per-user values.
Meta::OBJECT_TYPE_EVENT"event"Per-event values.

Scopes ​

ScopeParametersDescription
ofUser()$userIdRows of one user.
byKey()$metaKeyRows with one meta_key.

Usage ​

php
use FluentEvent\App\Models\Meta;

// Store your own per-event value.
Meta::query()->updateOrCreate(
    ['object_type' => Meta::OBJECT_TYPE_EVENT, 'object_id' => $eventId, 'meta_key' => 'my_plugin_badge'],
    ['value' => ['label' => 'Featured']]
);

FluentEvent developer documentation