Commit 6b739745 authored by Callum McIntyre's avatar Callum McIntyre

Added new touch function to eloquent, updates timestamps and immediately saves

Signed-off-by: 's avatarCallum McIntyre <mcintyre1994@gmail.com>
parent ec13efb7
...@@ -452,6 +452,16 @@ abstract class Model { ...@@ -452,6 +452,16 @@ abstract class Model {
if ( ! $this->exists) $this->created_at = $this->updated_at; if ( ! $this->exists) $this->created_at = $this->updated_at;
} }
/**
*Updates the timestamp on the model and immediately saves it.
*
* @return void
*/
public function touch(){
$this->timestamp();
$this->save();
}
/** /**
* Get a new fluent query builder instance for the model. * Get a new fluent query builder instance for the model.
* *
......
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