private function getCollectionClass($className)
{
// Return something in the very very unlikely scenario the model doesn't
// have a newCollection() method.
if (!method_exists($className, 'newCollection')) {
return '\\Illuminate\\Database\\Eloquent\\Collection';
}
/** @var \Illuminate\Database\Eloquent\Model $model */
$model = new $className();
return '\\' . get_class($model->newCollection());
}