public function userHasVoted($user) { if ($user === null) { return false; } return $this->votes()->where('vote_user_id', $user->user_id)->exists(); }