/** * @param Committee $committee The committee for which the user should be helping. * @param User $user The user to check helping status for. * @return ActivityParticipation|null Return the ActivityParticipation for the supplied user and committee in combination with this activity. Returns null if there is none. */ public function getHelpingParticipation(Committee $committee, User $user) { $h = HelpingCommittee::where('activity_id', $this->id)->where('committee_id', $committee->id)->first(); if ($h === null) { return null; } $p = ActivityParticipation::where('activity_id', $this->id)->where('user_id', $user->id)->where('committees_activities_id', $h->id)->first(); return $p; }