title: Laravel: collect() helper - set type of collection
body: <p>If I do this:</p>
  <pre><code>$obj = factory(Object::class)-&gt;make();
  
  collect($obj);
  </code></pre>
  <p>I am returned a collection of type:</p>
  <pre><code>Illuminate\Support\Collection
  </code></pre>
  <p>Laravel also lets you define your own collections with their specific methods.  In the model, you do:</p>
  <pre><code>public function newCollection(array $models = [])
  {
      return new CustomCollection($models);
  }
  </code></pre>
  <p>and you would make your <code>CustomCollection</code>, starting like this, in the file CustomCollection.php:</p>
  <pre><code>class CustomCollection extends Collection
  {
  </code></pre>
  <p>I'm wondering how I can return a collection of type:</p>
  <pre><code>Illuminate\Database\Eloquent\Collection
  </code></pre>
  <p>or, in the case of creating my own custom collection, how could I return a collection of type:</p>
  <pre><code>App\Models\CustomCollection
  </code></pre>
  <p>I'd like to do this with the <code>collect()</code> helper or any other way where I don't access the database for purposes of writing PHPUnit tests.</p>
  <p>==========</p>
  <p>EDIT: I'm using <code>factory(Object::class)-&gt;make()</code> to spoof Eloquent objects which I was trying to roll into collections.</p>
  <p>If you just do <code>factory(Object::class, 1)-&gt;make()</code> instead, the factory rolls the single instance of <code>Object::class</code> into an Eloquent collection for you.</p>