From 78a2e6bc88bc2ecd23a61ac4af66162bd04388fd Mon Sep 17 00:00:00 2001 From: drewroberts Date: Tue, 22 Dec 2020 13:04:21 -0500 Subject: [PATCH] Save updater on image & video models #1 #2 --- src/Models/Image.php | 6 ++++++ src/Models/Video.php | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/Models/Image.php b/src/Models/Image.php index e6cdb33..184d648 100644 --- a/src/Models/Image.php +++ b/src/Models/Image.php @@ -22,6 +22,12 @@ protected static function boot() $image->height = $data[1]; } }); + + static::saving(function ($image) { + if (auth()->check()) { + $image->updater_id = auth()->id(); + } + }); } public function getUrlAttribute() diff --git a/src/Models/Video.php b/src/Models/Video.php index c09f6fc..a6bca8d 100644 --- a/src/Models/Video.php +++ b/src/Models/Video.php @@ -31,6 +31,9 @@ protected static function boot() if (empty($video->source)) { $video->source = 'youtube'; } + if (auth()->check()) { + $video->updater_id = auth()->id(); + } }); }