Skip to content

Commit

Permalink
Save updater on image & video models #1 #2
Browse files Browse the repository at this point in the history
  • Loading branch information
drewroberts committed Dec 22, 2020
1 parent abfe4c7 commit 78a2e6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Models/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions src/Models/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ protected static function boot()
if (empty($video->source)) {
$video->source = 'youtube';
}
if (auth()->check()) {
$video->updater_id = auth()->id();
}
});
}

Expand Down

0 comments on commit 78a2e6b

Please sign in to comment.