PHPackages                             zaratedev/laravel-excludable - 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. zaratedev/laravel-excludable

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

zaratedev/laravel-excludable
============================

Exclude the provided elements from the query results.

v1.0.1(3y ago)26MITPHPPHP ^7.4|^8.0|^8.1

Since Jan 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/zaratedev/laravel-excludable)[ Packagist](https://packagist.org/packages/zaratedev/laravel-excludable)[ Docs](https://github.com/zaratedev/laravel-excludable)[ RSS](/packages/zaratedev-laravel-excludable/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Excludable
==================

[](#laravel-excludable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/02db88e1263e746e8c9f5e8b5d75d8b75cd420bfe112b07a02c1fc6e37fdf7ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a61726174656465762f6c61726176656c2d6578636c756461626c65)](https://camo.githubusercontent.com/02db88e1263e746e8c9f5e8b5d75d8b75cd420bfe112b07a02c1fc6e37fdf7ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a61726174656465762f6c61726176656c2d6578636c756461626c65)[![Total Downloads](https://camo.githubusercontent.com/c7c30fe4d9f95da7bbcc11e275bc48abe768af0dcb182d5c806c3912539dba13/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a61726174656465762f6c61726176656c2d6578636c756461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zaratedev/laravel-excludable)[![GitHub Actions](https://github.com/zaratedev/laravel-excludable/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/zaratedev/laravel-excludable/actions/workflows/main.yml)

[![Banner](https://camo.githubusercontent.com/c3c72c1d6d24e45af74db503579e2f36c118fe55240cc32bae8e1127aab22da2/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304578636c756461626c652e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d7a61726174656465762532466c61726176656c2d6578636c756461626c65267061747465726e3d666f7572506f696e745374617273267374796c653d7374796c655f31266465736372697074696f6e3d4578636c7564652b7468652b70726f76696465642b656c656d656e74732b66726f6d2b7468652b71756572792b726573756c7473266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/c3c72c1d6d24e45af74db503579e2f36c118fe55240cc32bae8e1127aab22da2/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304578636c756461626c652e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d7a61726174656465762532466c61726176656c2d6578636c756461626c65267061747465726e3d666f7572506f696e745374617273267374796c653d7374796c655f31266465736372697074696f6e3d4578636c7564652b7468652b70726f76696465642b656c656d656e74732b66726f6d2b7468652b71756572792b726573756c7473266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

This package allow to your eloquent models apply exclude provides elements from the query results.

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

[](#installation)

You can install the package via composer:

```
composer require zaratedev/laravel-excludable
```

Usage
-----

[](#usage)

Use the Excludable trait in any Eloquent Model.

```
use Illuminate\Database\Eloquent\Model;
use ZarateDev\LaravelExcludable\Excludable;

class User extends Model
{
    use Excludable;
}
```

Now you have available scope `exclude()` method in Eloquent Model.

```
use App\Models\User;

class UserController extends Controller
{
    public function index()
    {
        $user = auth()->user();

        $users = User::query()->exclude($user)->get();

        return view('users.index', compact('users'));
    }
}
```

The method `exclude` can recieved attribute of type collection, model, integer, array. For more examples see test suits.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jonathan Zarate](https://github.com/zaratedev)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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 ~0 days

Total

2

Last Release

1212d ago

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

v1.0.1PHP ^7.4|^8.0|^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c559b2600853d5043f93277c8f4866505ddfe5058f65ea0d541e04b71c91cf7?d=identicon)[zaratedev](/maintainers/zaratedev)

---

Top Contributors

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

---

Tags

laravellaravel-frameworklaravel-packageexcludeeloquent-modelslaravel-excludable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zaratedev-laravel-excludable/health.svg)

```
[![Health](https://phpackages.com/badges/zaratedev-laravel-excludable/health.svg)](https://phpackages.com/packages/zaratedev-laravel-excludable)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)

PHPackages © 2026

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