kelrob
1 year ago

Help in Fetching of records

Posted 1 year ago by kelrob

Hello Laracasts!!

So I am having an issues with fetching a particular kind of record from the database.

I have three different tables

  1. Friends
  2. Followers
  3. PictureGalleries

Here are the table structures

Friends:

| id | senderId | receiverId | accepted | |----|----------|------------|----------| | 1 | 1 | 12 | 1 | | 2 | 12 | 2 | 1 | | 2 | 12 | 2 | 1 |

Followers:

| id | userId | UserIsFollowing | | ------------- | ------------- | ------------- | | 1 | 12 | 63 | | 2 | 22 | 12 |

PictureGalleries:

| id | UserId | | ------------- | ------------- | | 1 | 13 | | 2 | 12 | | 3 | 1 | | 4 | 10 | | 5 | 2 | | 6 | 63 |

So now here is the Issue!

I want to select all from the Picture Galleries Where the the user has a friendship relationship with a particular user Id where accepted is 1 And Where the user is following a particular user

Lets take this User has an Id of 12.

So Basically the result I want to see is the picture gallery of the following users

ID: 1,2, and 63

I just Hope I did not confuse You guys. Thanks!

Please sign in or create an account to participate in this conversation.