public function votesForUser($user = null) { if ($user === null) { return []; } $votes = ContestVote::where('contest_id', $this->id)->where('user_id', $user->user_id)->get(); return $votes->map(function ($v) { return $v->contest_entry_id; })->toArray(); }