title: ACL Query Limiting for Laravel
body: <p>I've huge concern about my Eloquent based application. Let me write my model structure. I've Post, Group and User model. Group is polymorphic model that has belongsToMany relation with both User and Post models. For both User and Post model, it's not required to have group. Both can be or cannot be able to have groups. What I want to do is, if logged in user is not member of the group of post, it won't show on the <code>Posts::get();</code> action.</p>
  
  <p><strong>Post Model:</strong>
  id | name | content</p>
  
  <p><strong>Group Model</strong>
  id | name</p>
  
  <p><strong>User Model</strong>
  id | username</p>
  
  <p><strong>user_groups: pivot table</strong>
  user_id | group_id</p>
  
  <p><strong>post_groups: pivot table</strong>
  post_id | group_id</p>
  
  <p>I know it can be done with collection filter. But it's not best practice for this case. I am really want how to do it on query builder side.</p>