A documentation section has been added to the site.
This commit is contained in:
@@ -5,9 +5,11 @@ namespace App\Repositories;
|
||||
use App\Dto\Builder\Documentation as DocumentationBuilderDto;
|
||||
use App\Contracts\Search;
|
||||
use App\Models\Documentation;
|
||||
use App\Models\ProjectLanguage;
|
||||
use App\Services\Documentation\BuilderCommand;
|
||||
use App\Services\Search\CreateSearchInstanceCommand;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
final readonly class DocumentationRepository
|
||||
@@ -32,9 +34,19 @@ final readonly class DocumentationRepository
|
||||
return Documentation::query()->where('id', $id)->first();
|
||||
}
|
||||
|
||||
public function getDocumentationByCode(string $code): ?Documentation
|
||||
public function getDocumentationBySlugWithContent(string $slug, int $versionId, ProjectLanguage $language): ?Documentation
|
||||
{
|
||||
return Documentation::query()->where('code', $code)->first();
|
||||
$with = [
|
||||
'content' => function (HasOne $hasOne) use ($language) {
|
||||
$hasOne->where('language_id', $language->id);
|
||||
}
|
||||
];
|
||||
|
||||
return Documentation::query()
|
||||
->where('version_id', $versionId)
|
||||
->where('slug', $slug)
|
||||
->with($with)
|
||||
->first();
|
||||
}
|
||||
|
||||
public function isExistsSlug(int $versionId, string $slug, ?int $exceptId = null): bool
|
||||
|
Reference in New Issue
Block a user