laravel-relation-save
📦laravel hasOne hasMany belongsto...
github
https://github.com/liaoshengping/laravel-relation-save
Installing
✈Usage
在模型中添加
🔨如何使用
🌰 example
比如有主表shop 和 store_detail
定义HasOne 关系
比如前端json 请求
创建数据简化前 (大概是这种意思)
我看了下Laravel-admin 的关联保存,对于快速开发的项目,觉得挺好的,值得学习。encore\laravel-admin\src\Form.php
只需如下可以保存关联关系的数据了
适用 创建和更新 ,可参考源码,学习更多小技巧。
✏Reference
【源码分析】Laravel-admin 关联保存的原理
Other
Contributing
You can contribute in one of three ways:
1. File bug reports using the issue tracker.
2. Answer questions or fix bugs on the issue tracker.
3. Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT