Laravel global scopes and multiple joins
<p>Due to need of content localization, the data of each localizable model is split into 2 tables, with base and localizable fields. So i added global scope with join for code cleaness. But now, if I'm trying to join another localized table, i'm getting this error.</p>

<pre><code>Undefined table: 7 ERROR: missing FROM-clause entry for table "posts"
</code></pre>

<p>Trouble code:</p>

<pre><code>$news = Post::orderIdDesc()
            -&gt;innerJoin('organizations', 'organization','id')
            -&gt;where('posts.organization', '=', $orgId)
            -&gt;select('*')
            -&gt;take(3)
            -&gt;get();
</code></pre>

<p>returns this sql:</p>

<pre><code>select * from "posts_uk"
  inner join "organizations" on "posts"."organization" = "organizations"."id"
  inner join "organizations_uk" on "organizations_uk"."id" = "organizations"."id"
  inner join "posts" on "posts_uk"."id" = "posts"."id"
where "posts"."organization" = 1
order by "posts_uk"."id" desc limit 3
</code></pre>

<p>As you can see, other part of Post model joined in the global scope, appends at the end of query, causing mentioned error.</p>

<p>Maybe there's some way to make global scope prepend it's join at the beginning, or any other resolution appliable.</p>

<p>Thx</p>