Files
Obsidian-Vault/Career/Others/Laravel relationships.md
2025-10-25 20:11:21 +02:00

12 lines
556 B
Markdown

---
created: 2025-02-06 11:23
updated: 2025-07-04 07:36
---
### belongsToMany
Argument query
belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null, $parentKey = null, $relatedKey = null, $relation = null)
```mysql
select `related_table`.*, `table`.`foreignPivotKey` as `pivot_foreignPivotKey`, `table`.`relatedPivotKey` as `pivot_relatedPivotKey` from `networks` inner join `table` on `networks`.`relatedKey` = `table`.`relatedPivotKey` where `table`.`foreignPivotKey` in (?) and `related_table`.`deleted_at` is null
```