|
@@ -378,6 +378,19 @@ abstract class Model {
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Delete the model from the database.
|
|
|
|
+ *
|
|
|
|
+ * @return int
|
|
|
|
+ */
|
|
|
|
+ public function delete()
|
|
|
|
+ {
|
|
|
|
+ if ($this->exists)
|
|
|
|
+ {
|
|
|
|
+ return $this->query()->where(static::$key, '=', $this->get_key())->delete();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Set the update and creation timestamps on the model.
|
|
* Set the update and creation timestamps on the model.
|
|
*
|
|
*
|