marshmallow/live-update 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

marshmallow/live-update

Composer 安装命令:

composer require marshmallow/live-update

包简介

Edit your Nova resources from the index page.

关键字:

README 文档

README

alt text

Laravel Nova Live Update

Latest Version on Packagist Total Downloads Issues License

Edit your Nova resources from the index page. This package adds a TextLiveUpdate field that is editable inline on the index view, so you can update a value without opening the resource's edit screen.

Requirements

  • PHP ^8.1
  • Laravel Nova ^5.0

Installation

Install the package via Composer:

composer require marshmallow/live-update

The package registers its service provider and assets automatically via Laravel's package auto-discovery, so there is nothing else to set up.

Usage

Use the TextLiveUpdate field in a Nova resource exactly like a regular Text field. It becomes editable directly on the index view:

use Marshmallow\LiveUpdate\TextLiveUpdate;

public function fields(NovaRequest $request)
{
    return [
        TextLiveUpdate::make('Name'),
    ];
}

When the value is changed inline, it is validated against the resource's update rules for that attribute before being saved.

Field types

Pass a type to control how the inline input behaves. Using date renders a date picker that saves on change and formats the value as Y-m-d:

TextLiveUpdate::make('Published At', 'published_at')->type('date');

Copyable

Render a button to copy the field's value to the clipboard:

TextLiveUpdate::make('Reference')->copyable();

Copy to another field

Copy the field's value into another field on the same form, with an optional tooltip:

TextLiveUpdate::make('Slug')->copyableTo('seo_slug', 'Copy to SEO slug');

Use as a placeholder

Render the field's value as a placeholder rather than an editable value:

TextLiveUpdate::make('Name')->asPlaceholder();

Listen to another field

Recompute this field's value when another field changes. The callback receives the changed value, the attribute, the model, and the request, and returns the new value:

TextLiveUpdate::make('Full Name')
    ->listen('first_name', 'change', function ($value, $attribute, $model, $request) {
        return trim($value . ' ' . $model->last_name);
    });

Copyable with a server-side action

Run a server-side action and copy its returned value. The action class must implement Marshmallow\LiveUpdate\CopyableActionInterface:

use Illuminate\Database\Eloquent\Model;
use Marshmallow\LiveUpdate\CopyableActionInterface;

class GenerateReference implements CopyableActionInterface
{
    public function execute(Model $model): ?string
    {
        return 'REF-' . $model->getKey();
    }
}

Then wire it up on the field. The optional when callback decides whether the action button is shown:

TextLiveUpdate::make('Reference')
    ->copyableWithAction(
        action: GenerateReference::class,
        icon: 'clipboard',
        target_field_label: 'Reference',
        tooltip: 'Generate a reference',
        when: fn () => true,
    );

Security

If you discover any security related issues, please email stef@marshmallow.dev instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see the License File for more information.

marshmallow/live-update 适用场景与选型建议

marshmallow/live-update 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 43.82k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 10 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 marshmallow/live-update 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 marshmallow/live-update 我们能提供哪些服务?
定制开发 / 二次开发

基于 marshmallow/live-update 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 43.82k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-08