diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 3013092e..47c62bf6 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -147,7 +147,7 @@ public static function query($class) // Since this method is only used for instantiating models for querying // purposes, we will go ahead and set the Query instance on the model. - $model->query = IoC::core('database')->connection(static::$connection)->table(static::table($class)); + $model->query = IoC::container()->core('database')->connection(static::$connection)->table(static::table($class)); return $model; } @@ -361,7 +361,7 @@ public function save() // Since the model was instantiated using "new", a query instance has not been set. // Only models being used for querying have their query instances set by default. - $this->query = IoC::core('database')->connection(static::$connection)->table(static::table($model)); + $this->query = IoC::container()->core('database')->connection(static::$connection)->table(static::table($model)); if (property_exists($model, 'timestamps') and $model::$timestamps) { @@ -410,7 +410,9 @@ public function delete($id = null) // delete statement to the query instance. if ( ! $this->exists) return $this->query->delete(); - return IoC::core('database')->connection(static::$connection)->table(static::table(get_class($this)))->delete($this->id); + $table = static::table(get_class($this)); + + return IoC::container()->core('database')->connection(static::$connection)->table($table)->delete($this->id); } /** @@ -487,7 +489,7 @@ public function __call($method, $parameters) // All of the aggregate and persistance functions can be passed directly to the query // instance. For these functions, we can simply return the response of the query. - if (in_array($method, array('insert', 'update', 'count', 'sum', 'min', 'max', 'avg'))) + if (in_array($method, array('insert', 'update', 'abs', 'count', 'sum', 'min', 'max', 'avg'))) { return call_user_func_array(array($this->query, $method), $parameters); }