Save workspace changes

This commit is contained in:
2026-04-18 17:02:56 +02:00
parent f02ea9a711
commit 87d60af5a9
4220 changed files with 1388603 additions and 1554 deletions

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Achievement;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class AchievementUnlockedNotification extends Notification
{
use Queueable;
public function __construct(private readonly Achievement $achievement) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'achievement_unlocked';
}
public function toDatabase(object $notifiable): array
{
return [
'type' => 'achievement_unlocked',
'achievement_id' => $this->achievement->id,
'achievement_slug' => $this->achievement->slug,
'title' => $this->achievement->name,
'icon' => $this->achievement->icon,
'message' => '🎉 You unlocked: ' . $this->achievement->name,
'xp_reward' => (int) $this->achievement->xp_reward,
'url' => '/dashboard?panel=achievements',
];
}
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Artwork;
use App\Models\ArtworkComment;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Str;
class ArtworkCommentedNotification extends Notification
{
use Queueable;
public function __construct(
private readonly Artwork $artwork,
private readonly ArtworkComment $comment,
private readonly User $actor,
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'artwork_commented';
}
public function toDatabase(object $notifiable): array
{
$label = $this->actor->name ?: $this->actor->username ?: 'Someone';
$slug = Str::slug((string) ($this->artwork->slug ?: $this->artwork->title)) ?: (string) $this->artwork->id;
return [
'type' => 'artwork_commented',
'artwork_id' => (int) $this->artwork->id,
'artwork_title' => $this->artwork->title,
'comment_id' => (int) $this->comment->id,
'actor_id' => (int) $this->actor->id,
'actor_name' => $this->actor->name,
'actor_username' => $this->actor->username,
'message' => $label . ' commented on your artwork',
'url' => route('art.show', ['id' => $this->artwork->id, 'slug' => $slug]) . '#comment-' . $this->comment->id,
];
}
}

View File

@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Artwork;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Str;
class ArtworkLikedNotification extends Notification
{
use Queueable;
public function __construct(
private readonly Artwork $artwork,
private readonly User $actor,
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'artwork_liked';
}
public function toDatabase(object $notifiable): array
{
$label = $this->actor->name ?: $this->actor->username ?: 'Someone';
$slug = Str::slug((string) ($this->artwork->slug ?: $this->artwork->title)) ?: (string) $this->artwork->id;
return [
'type' => 'artwork_liked',
'artwork_id' => (int) $this->artwork->id,
'artwork_title' => $this->artwork->title,
'actor_id' => (int) $this->actor->id,
'actor_name' => $this->actor->name,
'actor_username' => $this->actor->username,
'message' => $label . ' liked your artwork',
'url' => route('art.show', ['id' => $this->artwork->id, 'slug' => $slug]),
];
}
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Artwork;
use App\Models\ArtworkComment;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Str;
class ArtworkMentionedNotification extends Notification
{
use Queueable;
public function __construct(
private readonly Artwork $artwork,
private readonly ArtworkComment $comment,
private readonly User $actor,
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'artwork_mentioned';
}
public function toDatabase(object $notifiable): array
{
$label = $this->actor->name ?: $this->actor->username ?: 'Someone';
$slug = Str::slug((string) ($this->artwork->slug ?: $this->artwork->title)) ?: (string) $this->artwork->id;
return [
'type' => 'artwork_mentioned',
'artwork_id' => (int) $this->artwork->id,
'artwork_title' => $this->artwork->title,
'comment_id' => (int) $this->comment->id,
'actor_id' => (int) $this->actor->id,
'actor_name' => $this->actor->name,
'actor_username' => $this->actor->username,
'message' => $label . ' mentioned you in an artwork comment',
'url' => route('art.show', ['id' => $this->artwork->id, 'slug' => $slug]) . '#comment-' . $this->comment->id,
];
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Notifications;
use App\Models\Artwork;
use App\Models\Post;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
class ArtworkSharedNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public readonly Post $post,
public readonly Artwork $artwork,
public readonly User $sharer,
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'artwork_shared';
}
public function toDatabase(object $notifiable): array
{
return [
'type' => 'artwork_shared',
'post_id' => $this->post->id,
'artwork_id' => $this->artwork->id,
'artwork_title' => $this->artwork->title,
'sharer_id' => $this->sharer->id,
'sharer_name' => $this->sharer->name,
'sharer_username' => $this->sharer->username,
'message' => $this->sharer->name . ' shared your artwork "' . $this->artwork->title . '"',
'url' => "/@{$this->sharer->username}/posts",
];
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Notifications;
use App\Models\Post;
use App\Models\PostComment;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
class PostCommentedNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public readonly Post $post,
public readonly PostComment $comment,
public readonly User $commenter,
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'post_commented';
}
public function toDatabase(object $notifiable): array
{
return [
'type' => 'post_commented',
'post_id' => $this->post->id,
'comment_id' => $this->comment->id,
'commenter_id' => $this->commenter->id,
'commenter_name' => $this->commenter->name,
'commenter_username' => $this->commenter->username,
'message' => "{$this->commenter->name} commented on your post",
'url' => "/@{$this->post->user->username}/posts",
];
}
}

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Story;
use App\Models\StoryComment;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class StoryCommentedNotification extends Notification
{
use Queueable;
public function __construct(
private readonly Story $story,
private readonly StoryComment $comment,
private readonly User $actor,
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'story_commented';
}
public function toDatabase(object $notifiable): array
{
$label = $this->actor->name ?: $this->actor->username ?: 'Someone';
return [
'type' => 'story_commented',
'story_id' => (int) $this->story->id,
'story_title' => $this->story->title,
'comment_id' => (int) $this->comment->id,
'actor_id' => (int) $this->actor->id,
'actor_name' => $this->actor->name,
'actor_username' => $this->actor->username,
'message' => $label . ' commented on your story',
'url' => route('stories.show', ['slug' => $this->story->slug]) . '#story-comment-' . $this->comment->id,
];
}
}

View File

@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Story;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class StoryLikedNotification extends Notification
{
use Queueable;
public function __construct(
private readonly Story $story,
private readonly User $actor,
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'story_liked';
}
public function toDatabase(object $notifiable): array
{
$label = $this->actor->name ?: $this->actor->username ?: 'Someone';
return [
'type' => 'story_liked',
'story_id' => (int) $this->story->id,
'story_title' => $this->story->title,
'actor_id' => (int) $this->actor->id,
'actor_name' => $this->actor->name,
'actor_username' => $this->actor->username,
'message' => $label . ' liked your story',
'url' => route('stories.show', ['slug' => $this->story->slug]),
];
}
}

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Story;
use App\Models\StoryComment;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class StoryMentionedNotification extends Notification
{
use Queueable;
public function __construct(
private readonly Story $story,
private readonly StoryComment $comment,
private readonly User $actor,
) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'story_mentioned';
}
public function toDatabase(object $notifiable): array
{
$label = $this->actor->name ?: $this->actor->username ?: 'Someone';
return [
'type' => 'story_mentioned',
'story_id' => (int) $this->story->id,
'story_title' => $this->story->title,
'comment_id' => (int) $this->comment->id,
'actor_id' => (int) $this->actor->id,
'actor_name' => $this->actor->name,
'actor_username' => $this->actor->username,
'message' => $label . ' mentioned you in a story comment',
'url' => route('stories.show', ['slug' => $this->story->slug]) . '#story-comment-' . $this->comment->id,
];
}
}

View File

@@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\Story;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class StoryStatusNotification extends Notification
{
use Queueable;
public function __construct(
private readonly Story $story,
private readonly string $event,
private readonly ?string $reason = null,
) {
}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return in_array($this->event, ['approved', 'published'], true)
? 'story_published'
: 'story_status';
}
public function toDatabase(object $notifiable): array
{
$message = match ($this->event) {
'approved' => 'Your story "' . $this->story->title . '" was approved and published.',
'rejected' => 'Your story "' . $this->story->title . '" was rejected. Update it and resubmit for review.',
'published' => 'Your story "' . $this->story->title . '" is now published.',
default => 'Story update: "' . $this->story->title . '" status changed.',
};
return [
'type' => in_array($this->event, ['approved', 'published'], true)
? 'story_published'
: 'story.' . $this->event,
'story_id' => $this->story->id,
'title' => $this->story->title,
'slug' => $this->story->slug,
'status' => $this->story->status,
'reason' => $this->reason,
'message' => $message,
'url' => route('creator.stories.edit', ['story' => $this->story->id]),
];
}
}

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace App\Notifications;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class UserFollowedNotification extends Notification
{
use Queueable;
public function __construct(private readonly User $actor) {}
public function via(object $notifiable): array
{
return ['database'];
}
public function databaseType(object $notifiable): string
{
return 'user_followed';
}
public function toDatabase(object $notifiable): array
{
$label = $this->actor->name ?: $this->actor->username ?: 'Someone';
return [
'type' => 'user_followed',
'actor_id' => (int) $this->actor->id,
'actor_name' => $this->actor->name,
'actor_username' => $this->actor->username,
'message' => $label . ' started following you',
'url' => $this->actor->username ? '/@' . $this->actor->username : null,
];
}
}