Laravel latest not working (not appearing in my SQL query)
So I have a Student model with this function: public function latestStatus() { return $this->hasOne(StatusStudent::class)->latest(); } then I just do a query with this latestStatus() $query = Student::findOrFail(1); $query = $query->whereHas('latestStatus', function($query) use ($statusuri) { $query->where('status_id', 1); }); dd($query->toSql()); and…