outhebox/nova-duplicate-field

一个用于复制记录的Laravel Nova字段。

v1.0.0 2021-06-27 18:42 UTC

This package is auto-updated.

Last update: 2024-08-28 03:50:15 UTC


README

信息

GitHub release (latest by date) Packagist GitHub

允许用户通过Laravel Nova管理面板复制记录,包括所需的任何关系(目前支持HasMany)。

安装

composer require outhebox/nova-duplicate-field

在Nova资源顶部引用复制字段,然后在字段中包含必要的代码。

use OutheBox\DuplicateField\DuplicateField
DuplicateField::make('Duplicate')
    ->withMeta([
        'id' => $this->id, // id of record
        'model' => 'App\Models\Specialism', // model path
        'except' => ['status'], // an array of fields to not replicate (nullable).
        'override' => ['status' => 'pending'], // an array of fields and values which will be set on the modal after duplicating (nullable).
        'resource' => 'specialisms', // resource url
        'relations' => ['one', 'two'], // an array of any relations to load (nullable).
    ]),

目前复制字段仅适用于索引视图(计划扩展此功能,并且已经通过onlyOnIndex()选项实现)。

变更日志

请参阅CHANGELOG以获取更多关于最近更改的信息。

贡献

请参阅CONTRIBUTING以获取详细信息。

鸣谢

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。