Commit 21efdbf6 by Taylor Otwell

Remove insert and update methods from Eloquent.

parent 666ebf21
......@@ -303,33 +303,20 @@ abstract class Eloquent {
$this->timestamp();
}
$result = ($this->exists) ? $this->update() : $this->insert();
$this->dirty = array();
return $result;
}
/**
* Update an existing model in the database.
*
* @return bool
*/
private function update()
if ($this->exists)
{
return $this->query->where('id', '=', $this->attributes['id'])->update($this->dirty) == 1;
$result = $this->query->where('id', '=', $this->attributes['id'])->update($this->dirty) == 1;
}
/**
* Insert a new model into the database.
*
* @return bool
*/
private function insert()
else
{
$this->attributes['id'] = $this->query->insert_get_id($this->attributes);
return $this->exists = is_numeric($this->id);
$result = $this->exists = is_numeric($this->id);
}
$this->dirty = array();
return $result;
}
/**
......@@ -345,7 +332,7 @@ abstract class Eloquent {
return Query::table(static::table(get_class($this)))->delete($this->id);
}
return 0;
return $this->query->delete();
}
/**
......
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