*/ use HasFactory; public const string RoleAdmin = 'admin'; public const string RoleMember = 'member'; /** * @return array */ protected function casts(): array { return [ 'joined_at' => 'datetime', 'last_read_at' => 'datetime', 'muted_until' => 'datetime', 'pinned_at' => 'datetime', ]; } public function isMuted(): bool { return $this->muted_until !== null && $this->muted_until->isFuture(); } public function isPinned(): bool { return $this->pinned_at !== null; } /** * @return BelongsTo */ public function conversation(): BelongsTo { return $this->belongsTo(Conversation::class); } /** * @return BelongsTo */ public function user(): BelongsTo { return $this->belongsTo(User::class); } }