title: Laravel toSql does not exists after flatten()
body: <p>Here my code :</p>
  <pre><code>            $cards = Course::with('cards', 'cards.contexts', 'cards.user_contexts', 'cards.thisUser')
                  -&gt;where('name', 'LIKE', '%'. 'Kanji' .'%')
                  -&gt;get()
                  -&gt;pluck('cards')
                  -&gt;flatten()
                  -&gt;toSql();
  
              dd($cards);
  </code></pre>
  <p>I try to get the SQL code of my eloquent request.</p>
  <p>I get this error :</p>
  <blockquote>
  <p>&quot;Method Illuminate\Support\Collection::toSql does not exist.&quot;</p>
  </blockquote>
  <p>Anyone have an idea of the problem ? Thanks !</p>