PHPackages                             codewithtony/laravel-active-attribute - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. codewithtony/laravel-active-attribute

ActiveLaravel[Utility &amp; Helpers](/categories/utility)

codewithtony/laravel-active-attribute
=====================================

Laravel Active Attribute

1.0(7y ago)3919MITPHP

Since Nov 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/codeWithTony/laravel-active-attribute)[ Packagist](https://packagist.org/packages/codewithtony/laravel-active-attribute)[ RSS](/packages/codewithtony-laravel-active-attribute/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel Active Attribute
========================

[](#laravel-active-attribute)

Laravel Active Attribute adds `withInactive` and `onlyInactive` functionality to an Eloquent Model.

This can be used to automatically hide inactive records unless otherwise desired. A better solution might be the use [Soft Deletes](https://laravel.com/docs/5.5/eloquent#soft-deleting) but there are a number of reasons why you might want to use an active field.

This can also serve as a good example of how to do similar things to use Scopes and Macros in Laravel to manipulate queries at a higher level.

Install
-------

[](#install)

```
composer require codewithtony/laravel-active-attribute

```

Usage
-----

[](#usage)

Add the `HasActiveAttribute` to any Eloquent Model that has an `->active` field that is a 1/0 boolean

```
class Thing
{
    Use HasActiveAttribute;
    ...
}

```

After that you can use it as follows

```
Thing::all(); // only records where $model->active = 1
// or
Thing::withInactive()->all(); // records where $model->active = 1 OR 0
// or
Thing::onlyInactive()->all(); // only records where $model->active = 0

```

Customize Active Feild
----------------------

[](#customize-active-feild)

By default `active` is the default field that this will look at, to customize it you can set the constant `ACTIVE`. For example, if the field is named `is_active`.

```
class Thing
{
    const ACTIVE = 'is_active';
    Use HasActiveAttribute;
    ...
}

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Unknown

Total

1

Last Release

2736d ago

### Community

Maintainers

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

---

Tags

laravelactive

### Embed Badge

![Health badge](/badges/codewithtony-laravel-active-attribute/health.svg)

```
[![Health](https://phpackages.com/badges/codewithtony-laravel-active-attribute/health.svg)](https://phpackages.com/packages/codewithtony-laravel-active-attribute)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[forxer/laravel-gravatar

A library providing easy gravatar integration in a Laravel project.

4235.6k](/packages/forxer-laravel-gravatar)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)

PHPackages © 2026

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