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.11.0 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 All 78 releases
← All changes | Modules/Auth/Classes/Invitation.php +23 -7 2.5.02.10.01 View file →
@@ -9,13 +9,29 @@
9 9 use FluentCommunity\App\Models\XProfile;
10 10 use FluentCommunity\App\Services\Helper;
11 11 use FluentCommunity\Framework\Support\Arr;
12 12
13 +/**
14 + * @property int $id
15 + * @property int|null $user_id
16 + * @property int|null $post_id
17 + * @property string|null $message
18 + * @property string|null $message_rendered
19 + * @property mixed $meta
20 + * @property string|null $type
21 + * @property int $reactions_count
22 + * @property string|null $status
23 + * @property string|null $created_at
24 + * @property string|null $updated_at
25 + * @property-read User|null $user
26 + * @property-read XProfile|null $xprofile
27 + * @property-read BaseSpace|null $space
28 + */
13 29 class Invitation extends Model
14 30 {
15 31 protected $table = 'fcom_post_comments';
16 32
17 - protected $guarded = ['id'];
33 + protected $guarded = [ 'id' ];
18 34
19 35 protected $fillable = [
20 36 'user_id',
21 37 'post_id',
@@ -25,19 +41,19 @@
25 41 'type',
26 42 'reactions_count',
27 43 'status',
28 44 'created_at',
29 - 'updated_at'
45 + 'updated_at',
30 46 ];
31 47
32 48 protected $searchable = [
33 - 'message'
49 + 'message',
34 50 ];
35 51
36 52 protected $hidden = [
37 53 'parent_id',
38 54 'content_type',
39 - 'is_sticky'
55 + 'is_sticky',
40 56 ];
41 57
42 58 public static function boot()
43 59 {
@@ -96,9 +112,9 @@
96 112 if ($spaceId) {
97 113 $spaceRole = $user->getSpaceRole(BaseSpace::findOrFail($spaceId));
98 114 $query->where('post_id', $spaceId);
99 115
100 - if (!in_array($spaceRole, ['admin', 'moderator'])) {
116 + if (!in_array($spaceRole, [ 'admin', 'moderator' ])) {
101 117 $query->where('user_id', $user->ID);
102 118 }
103 119 } elseif (!$user->isCommunityModerator()) {
104 120 $query->where('user_id', $user->ID);
@@ -128,9 +144,9 @@
128 144 'user_id' => $inviteeId,
129 145 'post_id' => Arr::get($data, 'space_id'),
130 146 'message' => $data['email'],
131 147 'message_rendered' => $data['token'],
132 - 'meta' => ['role' => $data['role']],
148 + 'meta' => [ 'role' => $data['role'] ],
133 149 'type' => 'invitation',
134 150 'content_type' => $data['content_type'],
135 151 'status' => 'pending',
136 152 ]);
@@ -146,9 +162,9 @@
146 162 public function getAccessUrl()
147 163 {
148 164 return add_query_arg([
149 165 'fcom_action' => 'auth',
150 - 'invitation_token' => $this->message_rendered
166 + 'invitation_token' => $this->message_rendered,
151 167 ], Helper::baseUrl('/'));
152 168 }
153 169
154 170 public function isValid()