Commit b910676c authored by Jens Segers's avatar Jens Segers

Access to interal collection object, fixes #19

parent 5c438b18
......@@ -237,6 +237,10 @@ You can also perform raw expressions on the internal MongoCollection object, not
return $collection->find();
});
Or you can access the internal object directly:
User::raw()->find();
**Query Caching**
You may easily cache the results of a query using the remember method:
......
......@@ -410,12 +410,14 @@ class Builder extends \Illuminate\Database\Query\Builder {
* @param closure $expression
* @return mixed
*/
public function raw($expression)
public function raw($expression = null)
{
if ($expression instanceof Closure)
{
return call_user_func($expression, $this->collection);
}
return $this->collection;
}
/**
......
......@@ -96,6 +96,9 @@ class QueryTest extends PHPUnit_Framework_TestCase {
$this->assertInstanceOf('MongoCursor', $cursor);
$this->assertEquals(1, $cursor->count());
$collection = DB::collection('users')->raw();
$this->assertInstanceOf('MongoCollection', $collection);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment