# fluent-community/1.0.90/app/Models/Meta.php

FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS &amp; Online Courses, version 1.0.90. 55 lines.

- Page: https://pluginprobe.com/plugins/fluent-community/1.0.90/code/app/Models/Meta.php
- Raw: https://pluginprobe.com/plugins/fluent-community/1.0.90/raw/app/Models/Meta.php
- Modified: 2024-11-07T12:38:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-community/1.0.90/code/app/Models/Meta.php#L10-L20`.

```php
<?php

namespace FluentCommunity\App\Models;

/**
 *  Meta Model - DB Model for Meta table
 *
 *  Database Model
 *
 * @package FluentCommunity\App\Models
 *
 * @version 1.0.0
 */
class Meta extends Model
{
    protected $table = 'fcom_meta';

    protected $primaryKey = 'id';

    protected $guarded = ['id'];

    protected $fillable = [
        'object_type',
        'object_id',
        'meta_key',
        'value'
    ];

    public function setValueAttribute($value)
    {
        $this->attributes['value'] = maybe_serialize($value);
    }

    public function getValueAttribute($value)
    {
        return maybe_unserialize($value);
    }

    public function scopeByType($query, $type)
    {
        return $query->where('object_type', $type);
    }

    public function scopeByMetaKey($query, $key)
    {
        return $query->where('meta_key', $key);
    }

    public function scopeByObjectId($query, $objectId)
    {
        return $query->where('object_id', $objectId);
    }

}

```
