How to union two eloquent on Laravel
<p>I have a two eloquent and this is the code on each of them without <code>union</code>.
So I want to get all <code>styles</code> based on the logged user that is from his <code>organizations</code> and <code>schools</code></p>

<pre><code>$organization_styles    = Auth::user()-&gt;teacher-&gt;school-&gt;organization-&gt;styles;
$school_styles          = Auth::user()-&gt;teacher-&gt;school-&gt;styles;

echo "&lt;pre&gt;";
print_r($organization_styles-&gt;toArray());
echo "&lt;/pre&gt;";

echo "------------------------";

echo "&lt;pre&gt;";
print_r($school_styles-&gt;toArray());
echo "&lt;/pre&gt;";
</code></pre>

<p>and this is the result.</p>

<p><a href="https://i.stack.imgur.com/ep3oT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ep3oT.png" alt="enter image description here"></a></p>

<p>I want to union it and this is my current test but it gave me error</p>

<pre><code>$test = $school_styles-&gt;union($organization_styles);
</code></pre>