Download mettle / sendportal-core / PostgresSubscriberTenantRepository.php - Solve class 'PostgresSubscriberTenantRepository' not found
This file is part of the package mettle/sendportal-core.
Please go to our download page to download this composer package and to solve the problem class 'PostgresSubscriberTenantRepository' not found.
Download mettle/sendportal-core
Class is not correct?
Search class PostgresSubscriberTenantRepository
<?php
declare(strict_types=1);
namespace Sendportal\Base\Repositories\Subscribers;
use Carbon\CarbonPeriod;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Facades\DB;
class PostgresSubscriberTenantRepository extends BaseSubscriberTenantRepository
{
/**
* @inheritDoc
*/
public function getGrowthChartData(CarbonPeriod $period, int $workspaceId): array
{
$startingValue = DB::table('sendportal_subscribers')
->where('workspace_id', $workspaceId)
->where(function (Builder $q) use ($period) {
$q->where('unsubscribed_at', '>=', $period->getStartDate())
->orWhereNull('unsubscribed_at');
})
->where('created_at', '<', $period->getStartDate())
->count();
$runningTotal = DB::table('sendportal_subscribers')
->selectRaw("to_char(created_at, 'dd-mm-YYYY') AS date, count(*) as total")
->where('workspace_id', $workspaceId)
->where('created_at', '>=', $period->getStartDate())
->where('created_at', '<=', $period->getEndDate())
->groupBy('date')
->get();
$unsubscribers = DB::table('sendportal_subscribers')
->selectRaw("to_char(unsubscribed_at, 'dd-mm-YYYY') AS date, count(*) as total")
->where('workspace_id', $workspaceId)
->where('unsubscribed_at', '>=', $period->getStartDate())
->where('unsubscribed_at', '<=', $period->getEndDate())
->groupBy('date')
->get();
return [
'startingValue' => $startingValue,
'runningTotal' => $runningTotal->flatten()->keyBy('date'),
'unsubscribers' => $unsubscribers->flatten()->keyBy('date'),
];
}
}