sydante / laravel-eloquent-with-not-overwritten
为Eloquent添加一个方法,该方法在关联 'with' 时不会覆盖已建立的关系。
v1.0.0
2021-10-21 07:35 UTC
Requires
- php: >=7.3
- ext-json: *
- laravel/framework: >=8.0
Requires (Dev)
- mockery/mockery: ^1.4.4
- orchestra/testbench: ^6.21
- phpunit/phpunit: ^8.5.19|^9.5.8
- roave/security-advisories: dev-latest
README
为eloquent添加一个方法,该方法在关联时不会覆盖已建立的关系...
安装
$ composer require sydante/laravel-eloquent-with-not-overwritten -vvv
使用方法
$eloquentModel ->with( 'progresses', function (HasMany $builder) { $builder->select(['id', 'eloquent_model_id', 'workflow_id', 'status', 'admin_id']) ->orderBy('id'); } ) // Do not overwrite defined eager loaded relations ->withNotOverwritten('progresses.admin:id,name') ->withNotOverwritten('progresses.workflow:id,name') ->withNotOverwritten('progresses.workflow.adminRole:id,name,slug');
目的
贡献
您可以通过以下三种方式之一进行贡献
代码贡献过程不是很正式。您只需确保遵循PSR-0、PSR-1和PSR-2编码规范。任何新的代码贡献都必须附有适用的单元测试。
许可证
MIT