nsavinov/nova-json-schema-field

Laravel Nova JSON Schema 字段

v1.0.2 2018-09-06 11:26 UTC

This package is auto-updated.

Last update: 2024-09-17 10:44:08 UTC


README

Packagist

Laravel Nova 字段,用于显示 JSON schema 数据

screenshot at sep 06 15-11-54

安装

您可以通过 composer 将此包安装到使用 Nova 的 Laravel 应用中

composer require nsavinov/nova-json-schema-field

用法

资源内部

use Nsavinov\NovaJsonSchemaField\NovaJsonSchemaField;

public function fields(Request $request)
{
    return [
        // ...
        NovaJsonSchemaField::make('Settings', $this->schema())
                        ->listClass('list-reset'), // optional style class for detailed component
    ];
}

private function schema(): array
{
    return [
        // your schema
    ];
}

Schema 示例

{
	"type": "object",
	"required": [
		"foo",
		"bar"
	],
	"properties": {
		"bar": {
			"type": "integer"
		},
		"foo": {
			"type": "integer",
			"description": "foo"
		}
	}
}