Baseline snapshot of custom AI implementation before Laravel AI SDK migration. Includes: - Custom services: GeminiTextGenerationService, TextGenerationService (OpenAI), ImageGenerationService, AudioGenerationService, VideoGenerationService - IntentDetector for content moderation via keyword matching - AI enums: Intent, Orientation, UsageType - Blade prompt templates: system.blade.php, image.blade.php, video.blade.php - AiMessage with content_html accessor (markdown rendering) - AiUsageLog for monthly quota tracking per account - PostAssistantController with regex-based [GENERATE_*] parsing - WritingAssistantTab with markdown rendering, add-to-post, attachments - Workspace brand fields (name, description, tone, voice_notes) in system prompt - Session state block injected into prompts (thread counts, quota remaining) - AttachmentCollector pattern will replace the regex approach in Phase 2 - Post comments with replies, emoji reactions, real-time via Echo - Assets page with Unsplash + Giphy integrations
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Events;
|
|
|
|
use App\Models\PostComment;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Broadcasting\PrivateChannel;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
|
|
class PostCommentCreated implements ShouldBroadcastNow
|
|
{
|
|
use Dispatchable, InteractsWithSockets;
|
|
|
|
public function __construct(public PostComment $comment) {}
|
|
|
|
public function broadcastOn(): array
|
|
{
|
|
return [
|
|
new PrivateChannel('post.'.$this->comment->post_id),
|
|
];
|
|
}
|
|
|
|
public function broadcastWith(): array
|
|
{
|
|
return [
|
|
'comment' => [
|
|
'id' => $this->comment->id,
|
|
'user_id' => $this->comment->user_id,
|
|
'parent_id' => $this->comment->parent_id,
|
|
'body' => $this->comment->body,
|
|
'reactions' => $this->comment->reactions ?? [],
|
|
'created_at' => $this->comment->created_at->toISOString(),
|
|
'updated_at' => $this->comment->updated_at->toISOString(),
|
|
'user' => [
|
|
'id' => $this->comment->user->id,
|
|
'name' => $this->comment->user->name,
|
|
'photo_url' => $this->comment->user->photo_url,
|
|
],
|
|
],
|
|
];
|
|
}
|
|
}
|