【发布时间】:2020-05-15 03:28:45
【问题描述】:
我无法使用中间表将照片与标签关联起来。
在下面的示例中,如何在 Laravel 中使用 Eloquent 关系方法选择属于标签 1 的所有照片?
我有这些表:
-Photos Table
| id | name | description |
1 photo1.png ....
2 photo2.png ....
3 photo3.png ....
-Tags Table
| id | name |
1 Aesthetic
2 Dark
-Tags Relations
| id | tag_id | photo_id |
1 1 3
2 1 2
3 2 1
【问题讨论】:
标签: php mysql laravel eloquent eloquent-relationship