cleisonfreitas/association-remover
Composer 安装命令:
composer require cleisonfreitas/association-remover
包简介
Esse pacote possibilita ao usuário realizar a exclusão de um registro em modelo cascata.
README 文档
README
How to apply
- Install the package
composer require cleisonfreitas/association-remover
How to use
- After installing, just call GerenciarRelacaoTrait in your model and define which relations will be deleted after removing the record
Example:
class YourClassModel extends Model { use SoftDeletes, HasFactory, GerenciarRelacaoTrait; protected array $relacionamentos = [ 'relationOne', 'relationTow', ]; ... }
All the relations listed will be removed in case of this record been deleted.
Important
If you define that some relation will be removed with GerenciarRelacaoTrait you have to apply the same feature to model/relation you mentioned.
Example:
class FirstModel extends Model { use SoftDeletes, HasFactory, GerenciarRelacaoTrait; protected array $relacionamentos = [ 'seconModelRelation', ]; ... } class SecondModel extends Model { use SoftDeletes, HasFactory, GerenciarRelacaoTrait; protected array $relacionamentos = []; ... }
- The relacionamentos attribute can be empty
To more information, send me an email: cleison51@hotmail.com
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-16