feat: expor vertentes Casamentos/Corporate na jornada pública
Some checks failed
CI / static (pull_request) Successful in 2m32s
CI / unit (pull_request) Failing after 3m51s
CI / feature (pull_request) Failing after 3m17s
CI / container (pull_request) Successful in 23s
CI / browser (pull_request) Successful in 3m35s

Fecha o gap do MAN-126 na navegação e no portfólio: âncoras das
duas vertentes no header/footer, filtro por event_type e empty
state honesto para Corporate sem prova inventada.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-12 18:14:00 -03:00
parent 93b680c172
commit 39a7a310e9
9 changed files with 280 additions and 37 deletions

View File

@@ -4,7 +4,10 @@ declare(strict_types=1);
namespace App\Application\Queries\Marketing;
use App\Domain\Marketing\PortfolioVertical;
use App\Models\PortfolioCase;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
final class GetPublishedPortfolioCases
@@ -12,12 +15,37 @@ final class GetPublishedPortfolioCases
/**
* @return Collection<int, PortfolioCase>
*/
public function __invoke(): Collection
public function __invoke(?PortfolioVertical $vertical = null): Collection
{
return PortfolioCase::query()
return $this->baseQuery($vertical)->get();
}
/**
* @return LengthAwarePaginator<int, PortfolioCase>
*/
public function paginate(?PortfolioVertical $vertical = null, int $perPage = 9): LengthAwarePaginator
{
return $this->baseQuery($vertical)->paginate($perPage)->withQueryString();
}
/**
* @return Builder<PortfolioCase>
*/
private function baseQuery(?PortfolioVertical $vertical): Builder
{
$query = PortfolioCase::query()
->published()
->with(['images'])
->orderBy('sort_order')
->get();
->orderBy('sort_order');
if ($vertical !== null) {
$query->where(function (Builder $builder) use ($vertical): void {
foreach ($vertical->eventTypePatterns() as $pattern) {
$builder->orWhere('event_type', 'ilike', $pattern);
}
});
}
return $query;
}
}