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

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

safemood/laravel-magic-scopes
=============================

Laravel Magic Scopes auto-generates query scopes for your models — no code needed, just magic 🔮.

0.0.1(11mo ago)1262[1 PRs](https://github.com/Safemood/laravel-magic-scopes/pulls)MITPHPPHP ^8.4|^8.3CI passing

Since Jun 2Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Safemood/laravel-magic-scopes)[ Packagist](https://packagist.org/packages/safemood/laravel-magic-scopes)[ Docs](https://github.com/safemood/laravel-magic-scopes)[ GitHub Sponsors]()[ RSS](/packages/safemood-laravel-magic-scopes/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Magic Scopes
====================

[](#laravel-magic-scopes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5ea63312950a43a8f7996c1121c4a602d09f26e03e3bc04bcb7a7c52e659435a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736166656d6f6f642f6c61726176656c2d6d616769632d73636f7065732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/safemood/laravel-magic-scopes)[![GitHub Tests Action Status](https://camo.githubusercontent.com/e76841ce34064eb9449734f001f69fe4f12a3116b5ed008454eba2e5c0c9b91a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736166656d6f6f642f6c61726176656c2d6d616769632d73636f7065732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/safemood/laravel-magic-scopes/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f478d1c8c73448e7d7660e17c60c501341d1eb621135b72c5673781384898444/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736166656d6f6f642f6c61726176656c2d6d616769632d73636f7065732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/safemood/laravel-magic-scopes/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/9272ab59f5c48f6f4c9bafcf5b76e18c9fb3a0e305ad703616bad4c6a58061ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736166656d6f6f642f6c61726176656c2d6d616769632d73636f7065732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/safemood/laravel-magic-scopes)

Laravel Magic Scopes auto-generates query scopes for your models — no code needed, just magic 🔮.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Laravel Magic Scopes](#laravel-magic-scopes)
    - [Table of Contents](#table-of-contents)
    - [Installation](#installation)
    - [Usage](#usage)
        - [What It can do](#what-it-can-do)
        - [Boolean Field Scopes](#boolean-field-scopes)
        - [Enum Field Scopes](#enum-field-scopes)
        - [Foreign Key Scopes](#foreign-key-scopes)
        - [JSON Field Scopes](#json-field-scopes)
        - [Number Field Scopes](#number-field-scopes)
        - [Date Field Scopes](#date-field-scopes)
    - [Extend](#extend)
    - [Testing](#testing)
    - [Changelog](#changelog)
    - [Contributing](#contributing)
    - [Security Vulnerabilities](#security-vulnerabilities)
    - [Credits](#credits)
    - [License](#license)

---

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

[](#installation)

You can install the package via composer:

```
composer require safemood/laravel-magic-scopes
```

You can publish the config file with:

```
php artisan vendor:publish --tag="magic-scopes-config"
```

This is the contents of the published config file:

```
