PHPackages                             datomatic/nova-enum-field - 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. datomatic/nova-enum-field

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

datomatic/nova-enum-field
=========================

A Laravel Nova PHP 8.1 enum field with filters

v1.11.0(1mo ago)20134.2k—9.2%12MITPHPPHP &gt;=8.1CI passing

Since Mar 22Pushed 1y agoCompare

[ Source](https://github.com/datomatic/nova-enum-field)[ Packagist](https://packagist.org/packages/datomatic/nova-enum-field)[ RSS](/packages/datomatic-nova-enum-field/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (25)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/330014c7dd5030ef5c4e95d3af0830196d78da8f82aa2ac0a78a6be5f102aa02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461746f6d617469632f6e6f76612d656e756d2d6669656c642e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/datomatic/nova-enum-field)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/2b19c27052a8a8f6bbdba6f90832ec8904b32a1617c5aa24dd675e977c61849f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6461746f6d617469632f6e6f76612d656e756d2d6669656c642f7068702d63732d66697865722e796d6c3f6c6162656c3d636f64652532307374796c6526636f6c6f723d354645384233267374796c653d666f722d7468652d6261646765)](https://github.com/datomatic/nova-enum-field/actions/workflows/php-cs-fixer.yml)[![Total Downloads](https://camo.githubusercontent.com/38b0818448a2622cf472768e0ef58f2a4c65c8b1f17871acd0fe6d2e491917ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461746f6d617469632f6e6f76612d656e756d2d6669656c642e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/datomatic/nova-enum-field)

Laravel Nova Enum Field
=======================

[](#laravel-nova-enum-field)

Nova field for enums in PHP 8.1 and above (both pure `Enum` and `BackedEnum`) with [datomatic/enum-helper](https://github.com/datomatic/enum-helper) and [datomatic/laravel-enum-helper](https://github.com/datomatic/laravel-enum-helper) compatibility.

[![Select field on form](branding/select-field.png)](branding/select-field.png)

There is also a Nova Select filter and Nova Boolean filter: [![Select filter](branding/select-filter.png)](branding/select-filter.png)[![Boolean filter](branding/boolean-filter.png)](branding/boolean-filter.png)

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

[](#installation)

You can install this package in a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require datomatic/nova-enum-field
```

Setup
-----

[](#setup)

```
use App\Enums\UserType;
use Illuminate\Database\Eloquent\Model;

class Example extends Model
{
    protected $casts = [
        'user_type' => UserType::class,
    ];
}
```

Usage
-----

[](#usage)

You can use the `Enum` field in your Nova resource like this:

```
namespace App\Nova;

use App\Enums\UserType;
use Datomatic\Nova\Fields\Enum\Enum;

class Example extends Resource
{
    // ...

    public function fields(Request $request)
    {
        return [
            // ...

            Enum::make('User Type','user_type')->attach(UserType::class),

            // ...
        ];
    }
}
```

Be aware that order in which methods on the field are called can be sigificant. For example `nullable()` must be called before *before* `attach()`, and `options()` must be called *after* `attach()`.

If you use [datomatic/laravel-enum-helper](https://github.com/datomatic/laravel-enum-helper) you can set optionally a custom dynamic property or/and a subset of cases.
The default property is `description`.

```
Enum::make('User Type','user_type')
    ->nullable()
    ->property('excerpt')
    ->cases([UserType::ADMINISTRATOR,UserType::MODERATOR])
    ->attach(UserType::class),
```

### Filters

[](#filters)

If you would like to use the provided Nova Select filter, you can include it like this:

```
namespace App\Nova;

use App\Enums\UserPermissions;
use App\Enums\UserType;
use Datomatic\Nova\Fields\Enum\EnumFilter;

class Example extends Resource
{
    // ...

    public function filters(Request $request)
    {
        return [
            EnumFilter::make('user_type', UserType::class),

             // With optional name and default value:
            EnumFilter::make('user_type', UserType::class)
                ->name(__('User Type'))
                ->default(UserType::ADMINISTRATOR)
        ];
    }
}
```

Alternatively, you may wish to use the provided Nova Boolean filter:

```
namespace App\Nova;

use App\Enums\UserPermissions;
use App\Enums\UserType;
use Datomatic\Nova\Fields\Enum\EnumBooleanFilter;

class Example extends Resource
{
    // ...

    public function filters(Request $request)
    {
        return [
            EnumBooleanFilter::make('user_type', UserType::class),

            // With optional name and default value:
            EnumBooleanFilter::make('user_type', UserType::class)
                ->name(__('User Type'))
                ->default([UserType::ADMINISTRATOR, UserType::MODERATOR])
        ];
    }
}
```

If you use [datomatic/laravel-enum-helper](https://github.com/datomatic/laravel-enum-helper) you can set optionally a custom dynamic property or/and a subset of cases.
The default property is `description`.

```
// Enum filter
EnumFilter::make('user_type', UserType::class)
    ->name('User Type')
    ->property('excerpt')
    ->cases([UserType::ADMINISTRATOR,UserType::MODERATOR])
// Boolean Enum filter
EnumBooleanFilter::make('user_type', UserType::class)
    ->name('User Type')
    ->property('excerpt')
    ->cases([UserType::ADMINISTRATOR,UserType::MODERATOR])
```

Credits
-------

[](#credits)

- [Alberto Peripolli](https://github.com/trippo)
- [All Contributors](../../contributors)

Thanks
------

[](#thanks)

- [Süleyman ÖZEV](https://github.com/suleymanozev)
- [simplesquid/nova-enum-field](https://github.com/simplesquid/nova-enum-field)

License
-------

[](#license)

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

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance65

Regular maintenance activity

Popularity44

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 84.3% 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 ~63 days

Recently: every ~238 days

Total

24

Last Release

55d ago

Major Versions

v0.2.0 → v1.2.02022-06-20

PHP version history (2 changes)v1.0.0PHP &gt;=8.1.0

v1.6.1PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/497169?v=4)[Alberto Peripolli](/maintainers/trippo)[@trippo](https://github.com/trippo)

---

Top Contributors

[![trippo](https://avatars.githubusercontent.com/u/497169?v=4)](https://github.com/trippo "trippo (70 commits)")[![AndreSchwarzer](https://avatars.githubusercontent.com/u/6991100?v=4)](https://github.com/AndreSchwarzer "AndreSchwarzer (3 commits)")[![suleymanozev](https://avatars.githubusercontent.com/u/20399264?v=4)](https://github.com/suleymanozev "suleymanozev (2 commits)")[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (2 commits)")[![pou](https://avatars.githubusercontent.com/u/1508526?v=4)](https://github.com/pou "pou (2 commits)")[![bohemima](https://avatars.githubusercontent.com/u/195410?v=4)](https://github.com/bohemima "bohemima (1 commits)")[![sk4t0](https://avatars.githubusercontent.com/u/24701038?v=4)](https://github.com/sk4t0 "sk4t0 (1 commits)")[![okaufmann](https://avatars.githubusercontent.com/u/4414498?v=4)](https://github.com/okaufmann "okaufmann (1 commits)")[![korobkovandrey](https://avatars.githubusercontent.com/u/7293388?v=4)](https://github.com/korobkovandrey "korobkovandrey (1 commits)")

---

Tags

laravelenumnova

### Embed Badge

![Health badge](/badges/datomatic-nova-enum-field/health.svg)

```
[![Health](https://phpackages.com/badges/datomatic-nova-enum-field/health.svg)](https://phpackages.com/packages/datomatic-nova-enum-field)
```

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[simplesquid/nova-enum-field

A Laravel Nova field to add enums to resources.

52391.9k2](/packages/simplesquid-nova-enum-field)[naoray/nova-json

Nova json field to spread a json column throughout multiple fields.

37478.6k](/packages/naoray-nova-json)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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