Added new touch function to eloquent, updates timestamps and immediately saves
Signed-off-by: Callum McIntyre <mcintyre1994@gmail.com>
This commit is contained in:
parent
ec13efb743
commit
6b73974505
|
@ -452,6 +452,16 @@ public function timestamp()
|
|||
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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue