I have groups
table project_group
pivot table questions
table
groups
table:
+----+--------+---------------------+---------------------+
| 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 |
+----+--------+---------------------+---------------------+
pivot table 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 |
+-----+----------+------------+----------+---------+-----------+
questions table:
+----+----------+---------------+---------------------+---------------------+
| 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 |
+----+----------+---------------+---------------------+---------------------+
What I want is to display something like this:
GROUP 1
PRVO PITANJE?
DRUGO PITANJE?
BUT also to check if user 3 logged from pivot table and display that just for that user. I think it should be some JOIN project_group and question table and then to put where user_id = Atuh::id()
Any solution? :)