定制 laraorvite/eloquent-wildcard-validator 二次开发

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

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

laraorvite/eloquent-wildcard-validator

最新稳定版本:1.0

Composer 安装命令:

composer require laraorvite/eloquent-wildcard-validator

包简介

Fixes ErrorException: Indirect modification of overloaded property in Laravel nested validation.

README 文档

README

Tests License: MIT

This package fixes the ErrorException: Indirect modification of overloaded property that occurs in Laravel when performing wildcard validation on nested data structures containing Eloquent models or objects with magic methods.

The Problem

In Laravel core, when you validate nested data using wildcards (e.g., tickets.*.people.*.email), the validator attempts to initialize missing data. If the data contains Eloquent models, PHP throws an error because magic methods (__get and __set) do not support indirect modification by reference.

The Solution

This package transparently extends the Laravel Validator to ensure that all data is safely converted to a plain array (arrayified) before validation begins, preventing any illegal modification of model properties while preserving the original data integrity.

Installation

You can install the package via composer:

composer require laraorvite/eloquent-wildcard-validator

The package will automatically register its Service Provider.

Usage

No additional configuration is required. Use the Laravel Validator facade or $request->validate() as you normally would:

$data = [
    'orders' => Order::with('items')->get()
];

$request->validate([
    'orders.*.items.*.price' => 'required|numeric'
]);

Credits

  • LaraOrVite
  • Special thanks to the Laravel community.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固