Skip to content

Commit

Permalink
Fixed issue #2 and #1
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervriends committed Mar 14, 2021
1 parent b8d77a7 commit ee66553
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Badge/Command/CreateBadgeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ public function handle(CreateBadge $command)
Arr::get($command->data, "attributes.name", null),
Arr::get($command->data, "attributes.image", null),
Arr::get($command->data, "attributes.order", 0),
Arr::get($command->data, "attributes.dscription", null),
Arr::get($command->data, "attributes.description", null),
Arr::get($command->data, "attributes.isVisible", true)
);

$badge->created_at = time();

// Validate
$this->validator->assertValid($badge->getDirty());


// Save
$badge->save();
Expand Down
3 changes: 3 additions & 0 deletions src/BadgeCategory/Command/CreateBadgeCategoryHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ public function handle(CreateBadgeCategory $command)
Arr::get($command->data, "attributes.description", null),
Arr::get($command->data, "attributes.isEnabled", true),
);

$badgeCategory->created_at = time();

// Validate
$this->validator->assertValid($badgeCategory->getDirty());


// Create category
$badgeCategory->save();

Expand Down
1 change: 1 addition & 0 deletions src/UserBadge/Command/CreateUserBadgeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function handle(CreateUserBadge $command)
$badgeUser = new UserBadge;
$badgeUser->badge_id = $badge->id;
$badgeUser->user_id = $user->id;
$badgeUser->assigned_at = time();

// Set earned reason
if(Arr::has($command->data, "attributes.description")) {
Expand Down

0 comments on commit ee66553

Please sign in to comment.