26 lines
936 B
PHP
26 lines
936 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Models\ProjectTranslation;
|
|
use App\Services\Search\CreateSearchInstanceCommand;
|
|
use App\Services\Search\Search;
|
|
|
|
final readonly class ProjectTranslationRepository
|
|
{
|
|
public function __construct(
|
|
private CreateSearchInstanceCommand $createSearchInstanceCommand,
|
|
) { }
|
|
public function getProjectTranslations(int $projectId, int $languageId): Search
|
|
{
|
|
$query = ProjectTranslation::query()->where('project_id', $projectId)->where('language_id', $languageId);
|
|
return $this->createSearchInstanceCommand->execute($query);
|
|
}
|
|
|
|
public function getProjectTranslationsWithTrashed(int $projectId, int $languageId): Search
|
|
{
|
|
$query = ProjectTranslation::query()->withTrashed()->where('project_id', $projectId)->where('language_id', $languageId);
|
|
return $this->createSearchInstanceCommand->execute($query);
|
|
}
|
|
}
|