hasMany(GameSession::class); } // A student has many comments public function comments() { return $this->hasMany(Comment::class); } /* |--------------------------- | Helper methods |--------------------------- */ // Check if student already played today public function playedToday(): bool { return $this->sessions() ->whereDate('play_date', today()) ->whereHas('shots', fn($q) => $q->havingRaw('COUNT(*) >= 3')) ->exists(); } }