bug fixes.

This commit is contained in:
Taylor Otwell 2011-10-02 22:44:36 -05:00
parent dfe3a04651
commit 16575246af
2 changed files with 6 additions and 5 deletions

View File

@ -3,6 +3,7 @@
use Laravel\IoC;
use Laravel\Str;
use Laravel\Inflector;
use Laravel\Database\Manager as DB;
abstract class Model {
@ -148,7 +149,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::container()->core('database')->connection(static::$connection)->table(static::table($class));
$model->query = DB::connection(static::$connection)->table(static::table($class));
return $model;
}
@ -362,7 +363,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::container()->core('database')->connection(static::$connection)->table(static::table($model));
$this->query = DB::connection(static::$connection)->table(static::table($model));
if (property_exists($model, 'timestamps') and $model::$timestamps)
{
@ -413,7 +414,7 @@ public function delete($id = null)
$table = static::table(get_class($this));
return IoC::container()->core('database')->connection(static::$connection)->table($table)->delete($this->id);
return DB::connection(static::$connection)->table($table)->delete($this->id);
}
/**

View File

@ -285,7 +285,7 @@ protected function get_size($attribute)
$value = $this->attributes[$attribute];
$files = IoC::container()->resolve('laravel.input')->files();
$files = IoC::container()->resolve('laravel.input')->file();
return (array_key_exists($attribute, $files) ? $value['size'] / 1024 : Str::length(trim($value));
}
@ -459,7 +459,7 @@ protected function get_message($attribute, $rule)
// the default error message for the appropriate units.
if (in_array($rule, $this->size_rules) and ! $this->has_rule($attribute, $this->numeric_rules))
{
return (array_key_exists($attribute, IoC::container()->resolve('laravel.input')->files()))
return (array_key_exists($attribute, IoC::container()->resolve('laravel.input')->file()))
? rtrim($message, '.').' '.Lang::line('validation.kilobytes')->get($this->language).'.'
: rtrim($message, '.').' '.Lang::line('validation.characters')->get($this->language).'.';
}