New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

wowe/laravel-eloquent-scopes

Some general scopes for Eloquent
38 2

Larablocks Analysis

wowe/laravel-eloquent-scopes works with Laravel 5 (latest release v3.0.0, May 19, 2017), which reached end of life: no more fixes, even for security.

Laravel 4 in earlier releases.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5, past end of life
  • No release in the last 12 months (last: May 19, 2017)
  • 0 downloads a month (needs 10,000)
  • 2 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: May 19, 2017.
  • No releases in the last 12 months.
  • First released: Mar 2, 2015.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.

Install
composer require wowe/laravel-eloquent-scopes
Latest Version:v3.0.0
Laravel:5
Older releases:4
License:MIT
Last Updated:May 19, 2017
Links: GitHub  ·  Packagist
Maintainer: willrowe

Scopes for Laravel Eloquent

This package includes some useful global scopes for Laravel Eloquent.

Installation
Traits
Usage
Release Notes
Version Compatibility
License

Installation

Via Composer

composer require wowe/laravel-eloquent-scopes

Traits

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

Add Trait to Model

Add the ActivatableTrait to an Eloquent model.

use Wowe\Eloquent\Scopes\ActivatableTrait;

class Test extends \Eloquent
{
    use ActivatableTrait;

    const ACTIVE = 'is_active';
}


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

This Package Laravel
1.x.x 4.2.x
2.x.x 5.0.x
3.x.x 5.1.x

License

This package is open-sourced software licensed under the MIT license

Related Packages

n7olkachev/laravel-filterable

Nice and simple scope for your models

89 33
lacodix/laravel-global-or-scope

A Laravel package to add possibility to use global scopes with an or operation i...

1,363 5
sofa/hookable

Laravel Eloquent hooks system.

2,059,111 64
volosyuk/simple-eloquent

Adaptation of eloquent for retrieving its attributes

119,868 55
sfneal/scopes

Add custom constraints to all queries performed on an Eloquent Model.

63,674 0

Version History

Version Released PHP Laravel License
v3.0.0 5.1.* MIT
v2.0.0 >=5.4.0 5.0.* MIT
v1.0.0 >=5.4.0 4.2.* MIT