34 lines
1002 B
PHP
34 lines
1002 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\ActivityEvent;
|
|
use App\Models\User;
|
|
|
|
final class ActivityService
|
|
{
|
|
public function __construct(private readonly CommunityActivityService $communityActivity) {}
|
|
|
|
public function record(int $actorId, string $type, string $targetType, int $targetId, array $meta = []): void
|
|
{
|
|
ActivityEvent::record(
|
|
actorId: $actorId,
|
|
type: $type,
|
|
targetType: $targetType,
|
|
targetId: $targetId,
|
|
meta: $meta,
|
|
);
|
|
}
|
|
|
|
public function communityFeed(?User $viewer, string $filter = 'all', int $page = 1, int $perPage = CommunityActivityService::DEFAULT_PER_PAGE, ?int $actorUserId = null): array
|
|
{
|
|
return $this->communityActivity->getFeed($viewer, $filter, $page, $perPage, $actorUserId);
|
|
}
|
|
|
|
public function requiresAuthentication(string $filter): bool
|
|
{
|
|
return $this->communityActivity->requiresAuthentication($filter);
|
|
}
|
|
} |