Commit efeab583 authored by Jens Segers's avatar Jens Segers

Fixed collection attribute

parent e4d8417c
...@@ -54,7 +54,8 @@ class Connection { ...@@ -54,7 +54,8 @@ class Connection {
* @param string $name * @param string $name
* @return MongoDB * @return MongoDB
*/ */
public function getCollection($name) { public function getCollection($name)
{
return $this->db->{$name}; return $this->db->{$name};
} }
...@@ -63,7 +64,8 @@ class Connection { ...@@ -63,7 +64,8 @@ class Connection {
* *
* @return MongoDB * @return MongoDB
*/ */
public function getDb() { public function getDb()
{
return $this->db; return $this->db;
} }
......
...@@ -71,7 +71,8 @@ class ConnectionResolver implements ConnectionResolverInterface { ...@@ -71,7 +71,8 @@ class ConnectionResolver implements ConnectionResolverInterface {
* *
* @param array $config * @param array $config
*/ */
public function makeConnection($config) { public function makeConnection($config)
{
return new Connection($config); return new Connection($config);
} }
......
...@@ -55,6 +55,18 @@ abstract class Model extends \Illuminate\Database\Eloquent\Model { ...@@ -55,6 +55,18 @@ abstract class Model extends \Illuminate\Database\Eloquent\Model {
return new DateTime($value); return new DateTime($value);
} }
/**
* Get the table associated with the model.
*
* @return string
*/
public function getTable()
{
if (isset($this->collection)) return $this->collection;
return parent::getTable();
}
/** /**
* Get a new query builder instance for the connection. * Get a new query builder instance for the connection.
* *
......
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