@@ 42-50 (lines=9) @@ | ||
39 | return $this->subscribers()->where('user_id', '<>', Auth::id()); |
|
40 | } |
|
41 | ||
42 | public function attachSubscriber($user) |
|
43 | { |
|
44 | if (!Subscription::where('user_id', $user->id) |
|
45 | ->where('subscribable_type', Channel::class) |
|
46 | ->where('subscribable_id', $this->id) |
|
47 | ->exists()) |
|
48 | Subscription::create(['user_id'=>$user->id, 'user_type'=>config('discuss.user_type'), 'subscribable_type'=>Channel::class, 'subscribable_id'=>$this->id]); |
|
49 | ||
50 | } |
|
51 | ||
52 | public function detachSubscriber($user) |
|
53 | { |
@@ 97-104 (lines=8) @@ | ||
94 | $this->attachSubscriber($reply->user); |
|
95 | } |
|
96 | ||
97 | public function attachSubscriber($user) |
|
98 | { |
|
99 | if (!Subscription::where('user_id', $user->id) |
|
100 | ->where('subscribable_type', Thread::class) |
|
101 | ->where('subscribable_id', $this->id) |
|
102 | ->exists()) |
|
103 | Subscription::create(['user_id'=>$user->id, 'user_type'=>config('discuss.user_type'), 'subscribable_type'=>Thread::class, 'subscribable_id'=>$this->id]); |
|
104 | } |
|
105 | ||
106 | public function detachSubscriber($user) |
|
107 | { |