我有groups
表project_group
透视表questions
表
groups
表:
+----+--------+---------------------+---------------------+
| id | name | updated_at | created_at |
+----+--------+---------------------+---------------------+
| 1 | GROUP1 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
| 2 | GROUP2 | 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
+----+--------+---------------------+---------------------+
透视表project_group
:
+-----+----------+------------+----------+---------+-----------+
| ids | group_id | project_id | admin_id | user_id | user_name |
+-----+----------+------------+----------+---------+-----------+
| 4 | 115 | 1 | 1 | 3 | CLIENT |
| 5 | 115 | 2 | 1 | 3 | CLIENT |
+-----+----------+------------+----------+---------+-----------+
问表:
+----+----------+---------------+---------------------+---------------------+
| id | group_id | text | updated_at | created_at
+----+----------+---------------+---------------------+---------------------+
| 1 | 115 | PRVO PITANJE? | 2015-05-03 14:29:16 | 2015-05-03 14:29:16 |
| 26 | 115 | DRUGO PITANJE? | 2015-05-06 00:44:02 | 0000-00-00 00:00:00 |
+----+----------+---------------+---------------------+---------------------+
我想是为了显示是这样的:
GROUP 1
第一个问题?
另一个问题?
而且,以检查是否用户3从枢轴表和显示,仅仅针对该用户已登录。 我觉得应该是一些JOIN project_group和问题表,然后把where user_id = Atuh::id()
任何解决方案? :)