We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 326c5df commit 602b910Copy full SHA for 602b910
src/Channel/Traits/Channelable.php
@@ -14,13 +14,28 @@
14
15
namespace Vanilo\Channel\Traits;
16
17
+use Illuminate\Database\Eloquent\Collection;
18
use Illuminate\Database\Eloquent\Relations\MorphToMany;
19
+use Vanilo\Channel\Contracts\Channel;
20
use Vanilo\Channel\Models\ChannelProxy;
21
22
+/**
23
+ * @property-read Collection $channels
24
+ */
25
trait Channelable
26
{
27
public function channels(): MorphToMany
28
29
return $this->morphToMany(ChannelProxy::modelClass(), 'channelable');
30
}
31
+
32
+ public function isInChannel(Channel|int|string $channel): bool
33
+ {
34
+ return $this->channels->contains($channel);
35
+ }
36
37
+ public function isNotInChannel(Channel|int|string $channel): bool
38
39
+ return !$this->isInChannel($channel);
40
41
0 commit comments