feat(events): expose published events to storefront

This commit is contained in:
2026-09-18 14:33:28 -03:00
parent 8d2250d247
commit f6e8716218
5 changed files with 110 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Domains\Ticketing\Event\Controllers;
use App\Domains\Core\Tenant\Models\Tenant;
use App\Domains\Ticketing\Event\Models\Event;
use App\Domains\Ticketing\Event\Requests\ListPublicEventsRequest;
use App\Domains\Ticketing\Event\Resources\PublicEventResource;
use App\Domains\Ticketing\Event\Services\PublicEventService;
use App\Http\Controllers\Controller;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
class PublicEventController extends Controller
{
public function index(ListPublicEventsRequest $request, Tenant $tenant, PublicEventService $events): AnonymousResourceCollection
{
abort_unless($tenant->storefront_website_type_code === 'onticket_multi_event', 404);
$term = trim((string) $request->validated('q', ''));
return PublicEventResource::collection($events->list($tenant, $term, (int) $request->validated('page', 1)));
}
public function show(Tenant $tenant, Event $event, PublicEventService $events): PublicEventResource
{
abort_unless($tenant->storefront_website_type_code === 'onticket_multi_event', 404);
return PublicEventResource::make($events->find($tenant, $event));
}
}