Skip to content

Commit

Permalink
Added missing field last_updated_at
Browse files Browse the repository at this point in the history
  • Loading branch information
danidou committed May 6, 2024
1 parent 5a51099 commit 44dfee7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Models/Badgr/Badge.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Badge extends Model
'request_form_url' => 'json',
'badge_category_id' => 'integer',
'course_id' => 'integer',
'last_updated_at' => 'date',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
Expand Down Expand Up @@ -68,13 +69,15 @@ protected static function booted(): void
$badgePage->approval_type = $badge->badgePage['approval_type'];
$badgePage->request_form_url = $badge->badgePage['request_form_url'];
$badgePage->badge_category_id = $badge->badgePage['badge_category_id'];
$badgePage->last_updated_at = $badge->badgePage['last_updated_at'];

$badgePage->saveQuietly();

return true;
});

static::updating(function (Badge $badge) {

app(BadgrBadge::class)->update(
$badge->entityId,
$badge->name,
Expand All @@ -94,6 +97,7 @@ protected static function booted(): void
'approval_type' => $badge->badgePage['approval_type'],
'request_form_url' => $badge->badgePage['request_form_url'],
'badge_category_id' => $badge->badgePage['badge_category_id'],
'last_updated_at' => $badge->badgePage['last_updated_at'],
]
);

Expand Down Expand Up @@ -133,6 +137,7 @@ public function getRows()
$row['request_form_url'] = !empty($badgePage) ? json_encode($badgePage->getTranslations('request_form_url')) : '';
$row['badge_category_id'] = !empty($badgePage) ? $badgePage->badge_category_id : '';
$row['course_id'] = !empty($badgePage) && !empty($badgePage->course) ? $badgePage->course->id : '';
$row['last_updated_at'] = !empty($badgePage) && !empty($badgePage->last_updated_at) ? $badgePage->last_updated_at : '';

return $row->except(['alignments', 'tags', 'extensions', 'expires'])
->toArray();
Expand Down

0 comments on commit 44dfee7

Please sign in to comment.