laravel/framework — pull request #1842 by astoltz (2013-07-09 17:57:59+00:00)
Title: Cloned eloquent query builders do not clone the base query builder

Test Code:

```php
class TestModel extends Eloquent
{
}

$query = TestModel::select('test_model.*')->where('cheese', '=', 1);

var_dump($query->getQuery()->toSql());

try {
$countQuery = clone $query;
$countQuery->count();
} catch (Exception $e) {}

var_dump($query->getQuery()->toSql());
```

Expected result:
> string(59) "select "test_model".* from "test_models" where "cheese" = ?"
> string(59) "select "test_model".* from "test_models" where "cheese" = ?"

Actual result:
> string(59) "select "test_model".* from "test_models" where "cheese" = ?"
> string(66) "select count(*) as aggregate from "test_models" where "cheese" = ?"