# Use Eloquent's new whereRelation instead of whereHas and Query Builder

> whereRelation is practically whereHas with better readability. A short Today I Learned note from the Graffino team.

- URL: https://graffino.com/til/use-eloquents-new-whererelation-instead-of-wherehas-and-query-builder
- Author: Nick Ciolpan
- Channel: laravel
- Published: 2021-12-09
- Updated: 2021-12-09

```
$mostPopularWriters = Developer::whereHas('posts', function (Builder $query) {
    $query->where('likes', '>=', 10);
})->get();
```
becomes


```
$mostPopularWriters = Developer::whereRelation('posts', 'likes', '>=', 10)->get();
```
