PHPackages                             armincms/json - 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. armincms/json

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

armincms/json
=============

A Laravel Nova field.

0.5.2(6y ago)25149.4k—4.6%3[5 issues](https://github.com/armincms/json/issues)3MITPHPPHP &gt;=7.1.0

Since Nov 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/armincms/json)[ Packagist](https://packagist.org/packages/armincms/json)[ RSS](/packages/armincms-json/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (8)Used By (3)

json
====

[](#json)

A laravel nova field

##### Table of Contents

[](#table-of-contents)

- [Install](#install)
- [Usage](#usage)
- [Nested Usage](#nested-usage)
- [Action Usage](#action-usage)
- [Showing / Hiding Fields](#showing-and-hiding-fields)
- [Last Values](#last-values)
- [Separated Data](#separated-data)
- [Fill The Value](#fill-the-value)
- [Null Values](#null-values)
- [Auto Casting](#auto-casting)
- [About Implementation](#about-implementation)

Install
-------

[](#install)

```
composer require armincms/json
```

Usage
-----

[](#usage)

So simple.

```

  use Armincms\Json\Json;

  Json::make("ColumnName", [
      Select::make(__("Discount Type"), "type")
          ->options([
              'percent' => __('Percent'),
              'amount' => __('Amount'),
          ])->rules('required')->default('percent'),
      Number::make(__("Discount Value"), "value")
          ->rules("min:0")
          ->withMeta([
              'min' => 0
          ]),
  ]),

```

Nested Usage
------------

[](#nested-usage)

Storing nested data is very like straight data. just like the following; use the `Json` nested.

```
  use Armincms\Json\Json;

  Json::make("ColumnName", [
      Select::make(__("Discount Type"), "type")
          ->options([
              'percent' => __('Percent'),
              'amount' => __('Amount'),
          ])->rules('required')->default('percent'),
      Number::make(__("Discount Value"), "value")
          ->rules("min:0")
          ->withMeta([
              'min' => 0
          ]),
      // nested data
      Json::make("discount", [
        Select::make(__("Discount Type"), "type")
            ->options([
                'percent' => __('Percent'),
                'amount' => __('Amount'),
            ])->rules('required')->default('percent'),
        Number::make(__("Discount Value"), "value")
            ->rules("min:0")
            ->withMeta([
                'min' => 0
            ]),
      ]),
  ]),

```

Action Usage
------------

[](#action-usage)

It is possible to use the `Json` in the `Action` like follow:

```
use Armincms\Json\Json;

class UpdateTime extends Action
{
    use InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Perform the action on the given models.
     *
     * @param  \Laravel\Nova\Fields\ActionFields  $fields
     * @param  \Illuminate\Support\Collection  $models
     * @return mixed
     */
    public function handle(ActionFields $fields, Collection $models)
    {
      //
    }

    /**
     * Get the fields available on the action.
     *
     * @return array
     */
    public function fields()
    {
        return collect([
            /// some fields

            Json::make(mb_strtolower($meal), [
                Text::make(__("From"), 'from')->rules('required'),
                Text::make(__("Until"), 'until')->rules('required'),
                Json::make(mb_strtolower($meal), [
                    Text::make(__("From"), 'from'),
                    Text::make(__("Until"), 'until'),
                ]),
            ]),

            /// some fields
        ])->map(function($field) {
            return $field instanceof Json ? $field->fields() : [$field];
        })->flatten()->all();
    }
}

```

Showing And Hiding Fields
-------------------------

[](#showing-and-hiding-fields)

you can use the field `show/hide` methods on the JSON field. so this method will be called on each field under the `Json` field.The following example will hide all fields from the `index` view.

```
  use Armincms\Json\Json;

  Json::make("ColumnName", [
       // fields
  ])->hideFromIndex(),

```

Save Last Values
----------------

[](#save-last-values)

By default; we clean the last data for store new data. but, it's possible to save the last data. for this, call the `saveHistory` method on parent `Json` class. this causes us to overwrite the new data without clean the last data. see the follow:

```
  use Armincms\Json\Json;

  Json::make("ColumnName", [
       // fields
  ])->saveHistory(),

```

Separated Data
--------------

[](#separated-data)

If you want store fields in one column but show in a separate place; you should make multiple `Json` field by one name.see the following:

```
  use Armincms\Json\Json;

  Json::make("ColumnName", [
       // fields group 1
  ]),

  // other feilds

  Json::make("ColumnName", [
       // fields group 2
  ])->saveHistory(),

```

- ATTENTION: at this situation, you should use `saveHistory` for next `Json` field.

Fill The Value
--------------

[](#fill-the-value)

if you want to store the customized value of the field; you can use the `fillUsing`method and return custom value. see the follow:

- `fillUsing` accept three argumnets `$request`, `$attribute`, `$requestAttribute`.

```
  use Armincms\Json\Json;

  Json::make("ColumnName", [
       Number::make(__("Discount Value"), "value")
            ->rules("min:0")
            ->withMeta([
                'min' => 0
            ])->fillUsing(function($request, $attribute, $requestAttribute) {
                if($request->exists($requestAttribute)) {
                    return $request[$requestAttribute];
                }

                return 1000;
            }),
  ]),

```

Null Values
-----------

[](#null-values)

If there need to store some values as the `null`; you can use the `nullable` method that works like the Nova nullable. By default; nullable has the `true` value which means all values will be stored. But; It's possible to reject the storing of null values via passing the `false` value into the `nullable` method.

Auto Casting
------------

[](#auto-casting)

If not defined JSON casting for the field attribute; we will convert the field Value into JSON. if you need disable this feature; use the `ignoreCasting` method;

About Implementation
--------------------

[](#about-implementation)

Maybe there exists a question about how this package works?

I Should say that; this package doesn't have any corresponds component to the `Vuejs`. this package just uses `callback`'s for data storing. so; won't changed any field.

with this implementation, you have access to your original fields without changes. So; for interacts with other packages or fields, exists `toArray` method to access to defined fields.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity47

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

Total

7

Last Release

2259d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/188c6af1615930311adb86de0f0f1e9241b3306d8f7680c385caa6aa0810ca48?d=identicon)[zareismail](/maintainers/zareismail)

---

Top Contributors

[![zareismail](https://avatars.githubusercontent.com/u/23401061?v=4)](https://github.com/zareismail "zareismail (22 commits)")

---

Tags

jsonlaravel-nova-fieldnovajsonlaravelarraycollectionfieldnovaarmincms

### Embed Badge

![Health badge](/badges/armincms-json/health.svg)

```
[![Health](https://phpackages.com/badges/armincms-json/health.svg)](https://phpackages.com/packages/armincms-json)
```

###  Alternatives

[timothyasp/nova-color-field

A Laravel Nova Color Picker field.

781.6M5](/packages/timothyasp-nova-color-field)[inspheric/nova-defaultable

Default values for Nova fields when creating resources and running resource actions.

51174.8k1](/packages/inspheric-nova-defaultable)[optimistdigital/nova-notes-field

This Laravel Nova package adds a notes field to Nova's arsenal of fields.

52139.5k](/packages/optimistdigital-nova-notes-field)[outl1ne/nova-color-field

A Laravel Nova Color Picker field.

26249.4k](/packages/outl1ne-nova-color-field)[wemersonrv/input-mask

A Laravel Nova custom field text with masks on input

1196.4k](/packages/wemersonrv-input-mask)[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)
