Build world campaigns rewards and recaps

This commit is contained in:
2026-05-01 11:44:41 +02:00
parent 28e7e46e13
commit 257b0dbef6
100 changed files with 11300 additions and 367 deletions

View File

@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\WorldRewardGrant;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class WorldRewardGrantedNotification extends Notification
{
use Queueable;
public function __construct(private readonly WorldRewardGrant $grant)
{
}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'world_reward_granted';
}
public function toDatabase(object $notifiable): array
{
$world = $this->grant->world;
$rewardType = $this->grant->reward_type;
$title = trim(($world?->title ?? 'World') . ' ' . $rewardType->label());
return [
'type' => 'world_reward_granted',
'world_reward_grant_id' => (int) $this->grant->id,
'world_id' => (int) ($world?->id ?? 0),
'world_slug' => (string) ($world?->slug ?? ''),
'reward_type' => $rewardType->value,
'title' => $title,
'message' => 'You earned the ' . $title . ' reward.',
'xp_reward' => $rewardType->xpReward(),
'url' => route('dashboard.notifications'),
];
}
}