'integer', ]; } public function community() { return $this->belongsTo(Community::class); } public function user() { return $this->belongsTo(User::class); } public function comments() { return $this->hasMany(Comment::class); } public function votes() { return $this->morphMany(Vote::class, 'voteable'); } public function userVote($userId) { return $this->votes()->where('user_id', $userId)->first(); } }