feat: expor vertentes Casamentos/Corporate na jornada pública
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user