I am trying to write a MySQL select query using Laravel's Database Query Builder as follows:
Select all projects where the project's author_id equals the user's id , or where the project's group_id equals a group_id that the user is assigned to.
For example:
User 1 is in group 24. There are 3 projects in group 7. User 1 wants to see all of the projects from that group.
Database Tables:
users
+----+
| id |
+----+
projects
+-----------+----------+
| author_id | group_id |
+-----------+----------+
groups
+----+
| id |
+----+
groups_users_are_assigned
+---------+----------+
| user_id | group_id |
+---------+----------+
Any help on how to do this correctly in a single query would be amazing. Thanks!
LavarelorLaravel?