PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.01
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.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 / NotificationSubscription.php

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

66 lines 1.6 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\Models\XProfile;
6 use FluentCommunity\App\Models\User;
7
8 /**
9 * Legacy notification preference rows in fcom_notification_users.
10 *
11 * @deprecated 2.8.2 Preferences moved to fcom_notification_prefs; use
12 * NotificationPreference and the NotificationPref service instead.
13 * Retained so the pre-2.8.2 rows stay readable and third-party code
14 * referencing this model does not fatal. Nothing in the plugin
15 * writes through it any more.
16 *
17 * @package FluentCommunity\App\Models
18 *
19 * @version 1.0.0
20 */
21 class NotificationSubscription extends Model
22 {
23 protected $table = 'fcom_notification_users';
24
25 protected $primaryKey = 'id';
26
27 protected $guarded = ['id'];
28
29 protected $fillable = [
30 'object_id',
31 'user_id',
32 'is_read',
33 'object_type',
34 'notification_type'
35 ];
36
37 protected static function boot()
38 {
39 parent::boot();
40
41 static::creating(function ($model) {
42 $model->object_type = 'notification_pref';
43 });
44
45 static::updating(function ($model) {
46 $model->object_type = 'notification_pref';
47 });
48
49 // Add global scope to get only notifications
50 static::addGlobalScope('notification', function ($builder) {
51 $builder->where('object_type', 'notification_pref');
52 });
53 }
54
55 public function user()
56 {
57 return $this->belongsTo(User::class, 'user_id');
58 }
59
60 public function xprofile()
61 {
62 return $this->belongsTo(XProfile::class, 'user_id', 'user_id');
63 }
64
65 }
66