feat(events): authorize event editing and date changes by assigned event
This commit is contained in:
@@ -4,14 +4,17 @@ namespace App\Shared\Forms\Services;
|
||||
|
||||
use App\Domains\Core\Tenant\Models\SocialMedia;
|
||||
use App\Domains\Core\Tenant\Models\Tenant;
|
||||
use App\Domains\Ticketing\Event\Models\Event;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class EventFormService
|
||||
{
|
||||
/** @return array{social_media: Collection<int, SocialMedia>} */
|
||||
public function get(Tenant $tenant): array
|
||||
public function get(Tenant $tenant, ?int $eventId = null): array
|
||||
{
|
||||
$event = $tenant->activeEvent;
|
||||
$event = $eventId === null ? $tenant->activeEvent
|
||||
: Event::query()
|
||||
->where('tenant_code', $tenant->codigo)->findOrFail($eventId);
|
||||
$urls = $event?->socialMedia()
|
||||
->pluck('event_social_media.url', 'social_media.code') ?? collect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user