From c576c388b92ebda037d7669b36270560989f218e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 14 Sep 2011 00:15:05 -0500 Subject: [PATCH] added support for sequence to eloquent models. --- laravel/database/eloquent/model.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 90dd643a..68aee066 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -13,6 +13,20 @@ abstract class Model { */ public static $connection; + /** + * Indicates if the model has creation and update timestamps. + * + * @var bool + */ + public static $timestamps = false; + + /** + * The name of the auto-incrementing sequence associated with the model. + * + * @var string + */ + public static $sequence = null; + /** * The model query instance. * @@ -362,7 +376,7 @@ public function save() } else { - $success = is_numeric($this->attributes['id'] = $this->query->insert_get_id($this->attributes)); + $success = is_numeric($this->attributes['id'] = $this->query->insert_get_id($this->attributes, static::$sequence)); } ($this->exists = true) and $this->dirty = array();