jose-chan/entity-utils
最新稳定版本:v2.0.2
Composer 安装命令:
composer require jose-chan/entity-utils
包简介
README 文档
README
composer require "jose-chan/entity-utils"
laravel中使用
<?php $data = [ "a" => 1, "b" => "b", "c" => [ "d" => 1.22, "e" => "" ], "d" => [ [ "f" => "f", "g" => 4 ], [ "f" => "f", "g" => 4 ] ] ]; $entity = app(\JoseChan\Entity\Entity::class, ["data" => $data]);
指定对象类型
<?php class CEntity extends JoseChan\Entity\Entity{ } class MyEntity extends \JoseChan\Entity\Entity { protected $arrayAttributeEntity = [ "c" => CEntity::class ]; }
指定二维数组用的Collection
<?php class MyCollection extends \Illuminate\Support\Collection{ } class DEntity extends \JoseChan\Entity\Entity{ protected static function collection(){ return MyCollection::class; } }
使用自动校验数组
<?php class MyValidateEntity extends \JoseChan\Entity\ValidateEntity{ protected function rules(){ return [ "a" => "required" ]; } protected function messages(){ return [ "a.required" => "a属性必须存在" ]; } }
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-17