PHPackages                             animelhd/animes-watchlater - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. animelhd/animes-watchlater

ActiveLibrary

animelhd/animes-watchlater
==========================

User watchlater features for Laravel Application.

016PHP

Since May 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/animelhd/animes-watchlater)[ Packagist](https://packagist.org/packages/animelhd/animes-watchlater)[ RSS](/packages/animelhd-animes-watchlater/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Watchlater
------------------

[](#laravel-watchlater)

❤️ User watchlater feature for Laravel Application.

[![CI](https://github.com/overtrue/laravel-watchlater/workflows/CI/badge.svg)](https://github.com/overtrue/laravel-watchlater/actions)[![Latest Stable Version](https://camo.githubusercontent.com/0b55fe589dd58aa477593bae7420e3983d415d1d9054e4a4fe9384130836c4fb/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f6c61726176656c2d77617463686c617465722f762f737461626c652e737667)](https://packagist.org/packages/overtrue/laravel-watchlater)[![Latest Unstable Version](https://camo.githubusercontent.com/4c98cce79d4b88abce5fff4592c69a183421d2f9bd8aeb68f15be0b67a452e5d/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f6c61726176656c2d77617463686c617465722f762f756e737461626c652e737667)](https://packagist.org/packages/overtrue/laravel-watchlater)[![Total Downloads](https://camo.githubusercontent.com/4ea616c7b800d3deb25505c5aeac34a56db7361a6383c41943bbe4a568a236af/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f6c61726176656c2d77617463686c617465722f646f776e6c6f616473)](https://packagist.org/packages/overtrue/laravel-watchlater)[![License](https://camo.githubusercontent.com/6a2361c53433b601c574439674efe870b471b806d4a69a4b079e942961488609/68747470733a2f2f706f7365722e707567782e6f72672f6f766572747275652f6c61726176656c2d77617463686c617465722f6c6963656e7365)](https://packagist.org/packages/overtrue/laravel-watchlater)

[![Sponsor me](https://github.com/overtrue/overtrue/raw/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)

Installing
----------

[](#installing)

```
composer require animelhd/animes-watchlater -vvv
```

### Configuration &amp; Migrations

[](#configuration--migrations)

```
php artisan vendor:publish --provider="Animelhd\AnimesWatchlater\WatchlaterServiceProvider"
```

Usage
-----

[](#usage)

### Traits

[](#traits)

#### `Animelhd\AnimesWatchlater\Traits\Watchlaterer`

[](#animelhdanimeswatchlatertraitswatchlaterer)

```
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Animelhd\AnimesWatchlater\Traits\Watchlaterer;

class User extends Authenticatable
{
    use Watchlaterer;

}
```

#### `Animelhd\AnimesWatchlater\Traits\Watchlaterable`

[](#animelhdanimeswatchlatertraitswatchlaterable)

```
use Illuminate\Database\Eloquent\Model;
use Animelhd\AnimesWatchlater\Traits\Watchlaterable;

class Post extends Model
{
    use Watchlaterable;

}
```

### API

[](#api)

```
$user = User::find(1);
$post = Post::find(2);

$user->watchlater($post);
$user->unwatchlater($post);
$user->toggleWatchlater($post);
$user->getWatchlaterItems(Post::class)

$user->hasWatchlatered($post);
$post->hasBeenWatchlateredBy($user);
```

#### Get object watchlaterers:

[](#get-object-watchlaterers)

```
foreach($post->watchlaterers as $user) {
    // echo $user->name;
}
```

#### Get Watchlater Model from User.

[](#get-watchlater-model-from-user)

Used Watchlaterer Trait Model can easy to get Watchlaterable Models to do what you want. \_note: this method will return a `Illuminate\Database\Eloquent\Builder` \_

```
$user->getWatchlaterItems(Post::class);

// Do more
$watchlaterPosts = $user->getWatchlaterItems(Post::class)->get();
$watchlaterPosts = $user->getWatchlaterItems(Post::class)->paginate();
$watchlaterPosts = $user->getWatchlaterItems(Post::class)->where('title', 'Laravel-Watchlater')->get();
```

### Aggregations

[](#aggregations)

```
// all
$user->watchlaters()->count();

// with type
$user->watchlaters()->withType(Post::class)->count();

// watchlaterers count
$post->watchlaterers()->count();
```

List with `*_count` attribute:

```
$users = User::withCount('watchlaters')->get();

foreach($users as $user) {
    echo $user->watchlaters_count;
}

// for Watchlaterable models:
$posts = Post::withCount('watchlaterers')->get();

foreach($posts as $post) {
    echo $post->watchlaters_count;
}
```

### Attach user watchlater status to watchlaterable collection

[](#attach-user-watchlater-status-to-watchlaterable-collection)

You can use `Watchlaterer::attachWatchlaterStatus($watchlaterables)` to attach the user watchlater status, it will set `has_watchlatered` attribute to each model of `$watchlaterables`:

#### For model

[](#for-model)

```
$post = Post::find(1);

$post = $user->attachWatchlaterStatus($post);

// result
[
    "id" => 1
    "title" => "Add socialite login support."
    "created_at" => "2021-05-20T03:26:16.000000Z"
    "updated_at" => "2021-05-20T03:26:16.000000Z"
    "has_watchlatered" => true
 ],
```

#### For `Collection | Paginator | CursorPaginator | array`:

[](#for-collection--paginator--cursorpaginator--array)

```
$posts = Post::oldest('id')->get();

$posts = $user->attachWatchlaterStatus($posts);

$posts = $posts->toArray();

// result
[
  [
    "id" => 1
    "title" => "Post title1"
    "created_at" => "2021-05-20T03:26:16.000000Z"
    "updated_at" => "2021-05-20T03:26:16.000000Z"
    "has_watchlatered" => true
  ],
  [
    "id" => 2
    "title" => "Post title2"
    "created_at" => "2021-05-20T03:26:16.000000Z"
    "updated_at" => "2021-05-20T03:26:16.000000Z"
    "has_watchlatered" => false
  ],
  [
    "id" => 3
    "title" => "Post title3"
    "created_at" => "2021-05-20T03:26:16.000000Z"
    "updated_at" => "2021-05-20T03:26:16.000000Z"
    "has_watchlatered" => true
  ],
]
```

#### For pagination

[](#for-pagination)

```
$posts = Post::paginate(20);

$user->attachWatchlaterStatus($posts);
```

### N+1 issue

[](#n1-issue)

To avoid the N+1 issue, you can use eager loading to reduce this operation to just 2 queries. When querying, you may specify which relationships should be eager loaded using the `with` method:

```
// Watchlaterer
$users = User::with('watchlaters')->get();

foreach($users as $user) {
    $user->hasWatchlatered($post);
}

// with watchlaterable object
$users = User::with('watchlaters.watchlaterable')->get();

foreach($users as $user) {
    $user->hasWatchlatered($post);
}

// Watchlaterable
$posts = Post::with('watchlaters')->get();
// or
$posts = Post::with('watchlaterers')->get();

foreach($posts as $post) {
    $post->isWatchlateredBy($user);
}
```

### Events

[](#events)

**Event****Description**`Animelhd\AnimesWatchlater\Events\Watchlatered`Triggered when the relationship is created.`Animelhd\AnimesWatchlater\Events\Unwatchlatered`Triggered when the relationship is deleted.License
-------

[](#license)

MIT

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/efac36cdc88bc6d242b4cbb508d62ca73403962a61156e92dadedea02f599ae7?d=identicon)[animelhd](/maintainers/animelhd)

---

Top Contributors

[![animelhd](https://avatars.githubusercontent.com/u/110630973?v=4)](https://github.com/animelhd "animelhd (4 commits)")

### Embed Badge

![Health badge](/badges/animelhd-animes-watchlater/health.svg)

```
[![Health](https://phpackages.com/badges/animelhd-animes-watchlater/health.svg)](https://phpackages.com/packages/animelhd-animes-watchlater)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
