diff --git a/src/Badge/Command/CreateBadgeHandler.php b/src/Badge/Command/CreateBadgeHandler.php index 15e9421..bdcb389 100644 --- a/src/Badge/Command/CreateBadgeHandler.php +++ b/src/Badge/Command/CreateBadgeHandler.php @@ -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(); diff --git a/src/BadgeCategory/Command/CreateBadgeCategoryHandler.php b/src/BadgeCategory/Command/CreateBadgeCategoryHandler.php index 09a7349..81f4e06 100644 --- a/src/BadgeCategory/Command/CreateBadgeCategoryHandler.php +++ b/src/BadgeCategory/Command/CreateBadgeCategoryHandler.php @@ -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(); diff --git a/src/UserBadge/Command/CreateUserBadgeHandler.php b/src/UserBadge/Command/CreateUserBadgeHandler.php index 4056f1a..9abe3de 100644 --- a/src/UserBadge/Command/CreateUserBadgeHandler.php +++ b/src/UserBadge/Command/CreateUserBadgeHandler.php @@ -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")) {