From c64f825886fad98ba2d3aebdbd2f98f49d99e017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Wed, 22 Feb 2017 01:46:13 +0100 Subject: [PATCH] FIX: fix saving 'viewed' column with updated_at --- app/Models/Content/Content.php | 6 ++++++ app/Models/Content/ModelTraits/Content.php | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Models/Content/Content.php b/app/Models/Content/Content.php index fce60e27..8361c3ff 100644 --- a/app/Models/Content/Content.php +++ b/app/Models/Content/Content.php @@ -163,4 +163,10 @@ class Content extends Model return parent::save($options); } + + public function view() + { + $this->timestamps = false; + $this->increment('viewed'); + } } diff --git a/app/Models/Content/ModelTraits/Content.php b/app/Models/Content/ModelTraits/Content.php index ae8c210f..d983a346 100644 --- a/app/Models/Content/ModelTraits/Content.php +++ b/app/Models/Content/ModelTraits/Content.php @@ -86,10 +86,4 @@ trait Content return count($allFiles); } - - public function view() - { - $this->viewed++; - $this->save(['timestamps' => false]); - } } \ No newline at end of file