PHPackages                             wowe/laravel-eloquent-scopes - 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. [Database &amp; ORM](/categories/database)
4. /
5. wowe/laravel-eloquent-scopes

ActiveLibrary[Database &amp; ORM](/categories/database)

wowe/laravel-eloquent-scopes
============================

Some general scopes for Eloquent

v3.0.0(8y ago)2381MITPHP

Since Mar 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/willrowe/laravel-eloquent-scopes)[ Packagist](https://packagist.org/packages/wowe/laravel-eloquent-scopes)[ Docs](https://github.com/willrowe/laravel-eloquent-scopes)[ RSS](/packages/wowe-laravel-eloquent-scopes/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

Scopes for Laravel Eloquent
===========================

[](#scopes-for-laravel-eloquent)

This package includes some useful global scopes for Laravel Eloquent.

[Installation](#installation)
[Traits](#traits)
[Usage](#usage)
[Release Notes](#release-notes)
[Version Compatibility](#version-compatibility)
[License](#license)

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

```
composer require wowe/laravel-eloquent-scopes
```

Traits
------

[](#traits)

### ActivatableTrait

[](#activatabletrait)

When this trait is added to an Eloquent model, it will only return rows which have the `active` field set to `true`.

If you want to use a field with a different name than `active`, set a constant called `ACTIVE` on the Eloquent model to whichever name you would like to use.

The following methods are included with the trait:

- `deactivate`: sets the `active` field to `false`.
- `activate`: sets the `active` field to `true`.
- `withInactive`: will include all entries in results regardless of the value of the `active` field.
- `onlyInactive`: will include only those entries with `active` fields set to `false`.

Usage
-----

[](#usage)

### Add Trait to Model

[](#add-trait-to-model)

Add the [`ActivatableTrait`](#activatabletrait) to an Eloquent model.

```
use Wowe\Eloquent\Scopes\ActivatableTrait;

class Test extends \Eloquent
{
    use ActivatableTrait;

    const ACTIVE = 'is_active';
}
```

### Query Model

[](#query-model)

```
// Get all entries that are active
Test::all();

// Get a single entry only if active
Test::find(1);

// Get all entries
Test::withInactive()->get();

// Get all inactive entries
Test::inactiveOnly()->get();
```

Version Compatibility
---------------------

[](#version-compatibility)

This PackageLaravel1.x.x4.2.x2.x.x5.0.x3.x.x5.1.xLicense
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~202 days

Total

5

Last Release

3281d ago

Major Versions

v1.0.0 → 2.0.x-dev2015-03-02

v2.0.0 → v3.0.02017-05-19

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laraveleloquentscopes

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wowe-laravel-eloquent-scopes/health.svg)

```
[![Health](https://phpackages.com/badges/wowe-laravel-eloquent-scopes/health.svg)](https://phpackages.com/packages/wowe-laravel-eloquent-scopes)
```

###  Alternatives

[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

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