Laravel – latest() chained with where() behavior
So I have a many-to-many table with created_at and the foreign keys student_id and status_id. For each student, I want to retrieve an entry only if the latest one has status_id = 1. I tried it like this: (it's a…