---
title: "What an actor liked — Likes for Laravel | Roundly"
description: "likedItems() and likesOf() return a real MorphToMany of the models an actor likes — eager-loadable and paginatable."
url: https://roundly-consulting.com/open-source/docs/likes-for-laravel/liked-items
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Likes for Laravel](https://roundly-consulting.com/open-source/docs/likes-for-laravel.md)

# What an actor liked

Reverse the relation to list what an actor likes:

```php
$user->likedItems(Post::class)->get();              // posts the user actively likes
$user->likedItems(Post::class, 'love')->get();      // filtered by reaction
$user->likedItems(Post::class)->with('author')->paginate();  // real relation — eager-load & paginate
$user->likesOf(Post::class);                         // the underlying MorphToMany relation
```

likedItems() returns a real Eloquent relation, so constraints, eager loading and pagination work as usual. Soft-deleted (unliked) items drop out automatically and reappear on a re-like.

## The reaction on the pivot

The relation carries the reaction type on its pivot:

```php
foreach ($user->likedItems(Post::class)->get() as $post) {
    $post->pivot->type;   // the actor's earliest active reaction on it (or the filtered type)
}
```

Each item comes back once, however many reactions the actor left on it, and paginate()->total() counts items, not reactions. The pivot’s type is the actor’s earliest active reaction on the item, or the requested type when you filter by one.

For the opposite list — items an actor has not liked — use the whereNotLikedBy() scope on the likeable model.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/likes-for-laravel.md)
