首页 > 解决方案 > 如何使用模型从表中获取字段?

问题描述

示例表:

id|name

book_users

id|user_id|book_id|col_1|col_2

book_product

id|user_id|book_users_id|other_1|other_2

结果:

例如,对于用户 ID 1

  1. 书名 | book_users.col_1 | book_users.col_2

  2. 书名 | book_users.col_1 | book_users.col_2 | book_product.other_1 | book_product.other_2

帮帮我。

标签: laravel

解决方案


推荐阅读