Skip to content

Commit

Permalink
Update MediaTrait.php
Browse files Browse the repository at this point in the history
  • Loading branch information
marioSantos97 committed Jan 25, 2023
1 parent 7f92346 commit d3a6a4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/Models/Traits/MediaTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static function afterUpdate($entry)
foreach (self::$mediable as $column) {

$mediaField = null;
if ($original[$column] !== 'null' && $original[$column] !== null) {
if ($original[$column] !== 'null' && $original[$column] !== null && (int) $original[$column]) {
if ($entry->{$column} !== 'null' && $entry->{$column} !== null) {
// Delete media field associations
DB::table('media_field_has_media')->where('media_field_id', $original[$column])->delete();
Expand Down

0 comments on commit d3a6a4a

Please sign in to comment.