Distant relationship with Laravel

Asked

Viewed 128 times

4

I have this table structure and would like to know if who posted the thread or the reply is Member or moderator, but I couldn’t structure a relationship that works, someone can help me?

forum
      id - integer
      name - string

users
     id - integer
     name - string

threads
     id - integer
     user_id - integer
     communitie_id - integer
     title - string
     body - text

 replies 
     id - integer     
     thread_id - integer    
     author_id - integer    
     title - string    
     body - text

 forum_user
     forum_id - integer
     user_id - integer 
     type - moderator/member/owner
  • What is the relationship between the entities ? You have to start there.

  • community* which database you use?

  • I use mysql, but using eloquent

  • The field communitie_id on the table threads points to an item in the table forum, that’s it?

  • @Oh yeah, I even edited the code.

  • Did you find a solution? Poste as an answer to help other people.

Show 1 more comment

1 answer

1

  • Please include an example in the answer to not be dependent only on the link?

  • 1

    at lunch time I do it, @utluiz

Browser other questions tagged

You are not signed in. Login or sign up in order to post.