30 lines
1.2 KiB
PHP
30 lines
1.2 KiB
PHP
<?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));
|
|
}
|
|
}
|