File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
src/Illuminate/Database/Eloquent Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -62,13 +62,17 @@ protected function runSoftDelete()
6262
6363 $ time = $ this ->freshTimestamp ();
6464
65+ $ columns = [$ this ->getDeletedAtColumn () => $ this ->fromDateTime ($ time )];
66+
6567 $ this ->{$ this ->getDeletedAtColumn ()} = $ time ;
66- $ this ->{$ this ->getUpdatedAtColumn ()} = $ time ;
6768
68- $ query ->update ([
69- $ this ->getDeletedAtColumn () => $ this ->fromDateTime ($ time ),
70- $ this ->getUpdatedAtColumn () => $ this ->fromDateTime ($ time ),
71- ]);
69+ if ($ this ->timestamps ) {
70+ $ this ->{$ this ->getUpdatedAtColumn ()} = $ time ;
71+
72+ $ columns [$ this ->getUpdatedAtColumn ()] = $ this ->fromDateTime ($ time );
73+ }
74+
75+ $ query ->update ($ columns );
7276 }
7377
7478 /**
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ class DatabaseSoftDeletingTraitStub
5757 use \Illuminate \Database \Eloquent \SoftDeletes;
5858 public $ deleted_at ;
5959 public $ updated_at ;
60+ public $ timestamps = true ;
6061
6162 public function newQuery ()
6263 {
You can’t perform that action at this time.
0 commit comments