PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.6.01
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.6.01
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / app / Models / Meta.php

Meta.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 2.6.01, at app/Models/Meta.php

57 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCommunity\App\Models;
4
5 use FluentCommunity\App\Functions\Utility;
6
7 /**
8 * Meta Model - DB Model for Meta table
9 *
10 * Database Model
11 *
12 * @package FluentCommunity\App\Models
13 *
14 * @version 1.0.0
15 */
16 class Meta extends Model
17 {
18 protected $table = 'fcom_meta';
19
20 protected $primaryKey = 'id';
21
22 protected $guarded = ['id'];
23
24 protected $fillable = [
25 'object_type',
26 'object_id',
27 'meta_key',
28 'value'
29 ];
30
31 public function setValueAttribute($value)
32 {
33 $this->attributes['value'] = maybe_serialize($value);
34 }
35
36 public function getValueAttribute($value)
37 {
38 return Utility::safeUnserialize($value);
39 }
40
41 public function scopeByType($query, $type)
42 {
43 return $query->where('object_type', $type);
44 }
45
46 public function scopeByMetaKey($query, $key)
47 {
48 return $query->where('meta_key', $key);
49 }
50
51 public function scopeByObjectId($query, $objectId)
52 {
53 return $query->where('object_id', $objectId);
54 }
55
56 }
57