定制 dmkulyk/nova-validation-toast 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dmkulyk/nova-validation-toast

Composer 安装命令:

composer require dmkulyk/nova-validation-toast

包简介

Enhanced validation toast messages for Laravel Nova with deduplication and improved error handling

README 文档

README

Enhanced validation toast messages for Laravel Nova with deduplication and improved error handling.

🚨 The Problem

By default, Laravel Nova shows only a generic "There was a problem submitting the form" toast message when validation fails. The actual validation error messages are only visible in the browser console, making it difficult for users to understand what went wrong.

✅ The Solution

This package intercepts Nova's error handling and displays the actual error messages directly in toast notifications. Now users can see specific validation errors like "Database operation failed" or field-specific validation messages right in the UI, without the second generic toast message.

Before (Standard Nova Behavior)

Standard Nova Message

Generic error message that doesn't help users understand what went wrong

Problem (Without Package)

Two Toast Messages

Users see both generic and specific messages, creating confusion

After (With Nova Validation Toast)

Nova Validation Toast Demo

Clean, specific error messages that help users understand and fix validation errors

✨ Features

  • 🎯 Replaces Generic Messages: Shows actual validation errors instead of "There was a problem submitting the form"
  • 🚫 Error Deduplication: Prevents duplicate toast messages within a 2-second window
  • 📱 Console to Toast: Moves validation errors from browser console to user-visible toasts
  • 📋 JsonResponse Support: Displays error messages from JSON responses
  • 1️⃣ Single Toast Display: Shows only one toast per error, preventing message spam
  • 🔧 Server Error Handling: Automatically extracts and displays server validation errors
  • 🌐 Axios Interceptors: Hooks into Nova's requests to catch and display errors
  • ⚙️ Configurable: Easy to extend with additional error patterns
  • ✅ Laravel 10, 11 & 12 Compatible: Works with Laravel 10.x, 11.x, and 12.x
  • ✅ Nova 4 & 5 Compatible: Works with both Nova 4.x and 5.x

📦 Installation

You can install the package via composer:

composer require dmkulyk/nova-validation-toast

The package will automatically register its service provider.

🚀 Usage

The component automatically activates when Nova boots and enhances the default error handling behavior. No additional configuration is required.

Customization

If you need to customize the error patterns or behavior, you can publish the JavaScript assets:

php artisan vendor:publish --tag=nova-validation-toast-assets

Then modify the published JavaScript file in public/vendor/nova-validation-toast/ to suit your needs.

⚙️ Configuration

You can modify the KNOWN_ERRORS object in the JavaScript to add more error patterns that should be suppressed or handled differently:

const KNOWN_ERRORS = {
    formSubmit: 'there was a problem submitting the form',
    // Add more known error strings here as needed
};

🔧 How it Works

The component:

  1. Intercepts Nova's error handling system
  2. Deduplicates error messages to prevent spam
  3. Extracts validation errors from server responses
  4. Displays clean, user-friendly toast notifications
  5. Hooks into both Nova's request system and global axios interceptors

📄 License

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

dmkulyk/nova-validation-toast 适用场景与选型建议

dmkulyk/nova-validation-toast 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 1.62k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 dmkulyk/nova-validation-toast 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-16