Separate webinars from meetings and add conference billing.
Deploy Ladill Meet / deploy (push) Successful in 41s
Deploy Ladill Meet / deploy (push) Successful in 41s
Add restart meeting actions, a dedicated webinar sidebar flow billed at GHS 0.30 per participant, and reserve speaker-line space with a placeholder to prevent layout shift. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -79,8 +79,11 @@ class MeetingRoomController extends Controller
|
||||
|
||||
$this->sessions->end($session, $participant->user_ref ?? $participant->uuid);
|
||||
|
||||
return redirect()->route('meet.rooms.show', $session->room)
|
||||
->with('success', 'Meeting ended.');
|
||||
$room = $session->room;
|
||||
$route = $room->isWebinar() ? 'meet.webinars.show' : 'meet.rooms.show';
|
||||
|
||||
return redirect()->route($route, $room)
|
||||
->with('success', $room->isWebinar() ? 'Webinar ended.' : 'Meeting ended.');
|
||||
}
|
||||
|
||||
public function leave(Request $request, Session $session): RedirectResponse
|
||||
|
||||
@@ -44,7 +44,8 @@ class RoomController extends Controller
|
||||
$organization = $this->organization($request);
|
||||
$owner = $this->ownerRef($request);
|
||||
|
||||
$query = Room::owned($owner)->where('organization_id', $organization->id);
|
||||
$query = Room::owned($owner)->where('organization_id', $organization->id)
|
||||
->where('type', '!=', 'webinar');
|
||||
$this->scopeToBranch($request, $query);
|
||||
|
||||
$rooms = $query->orderByDesc('scheduled_at')->paginate(20);
|
||||
@@ -79,7 +80,7 @@ class RoomController extends Controller
|
||||
$validated = $request->validate([
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string', 'max:2000'],
|
||||
'type' => ['nullable', 'string', 'in:scheduled,webinar,town_hall'],
|
||||
'type' => ['nullable', 'string', 'in:scheduled,town_hall'],
|
||||
'scheduled_at' => ['nullable', 'date'],
|
||||
'duration_minutes' => ['nullable', 'integer', 'min:15', 'max:480'],
|
||||
'timezone' => ['nullable', 'timezone'],
|
||||
@@ -104,7 +105,7 @@ class RoomController extends Controller
|
||||
'auto_record' => $request->boolean('auto_record'),
|
||||
'live_captions' => $request->boolean('live_captions'),
|
||||
'webinar_auto_approve' => $request->boolean('webinar_auto_approve'),
|
||||
'stage_mode' => ($validated['type'] ?? '') === 'webinar',
|
||||
'stage_mode' => false,
|
||||
];
|
||||
|
||||
$data = array_merge($validated, [
|
||||
@@ -121,12 +122,6 @@ class RoomController extends Controller
|
||||
|
||||
if (! empty($validated['recurrence_rule']) && ! $isInstant) {
|
||||
$room = $this->recurring->createSeries($request->user(), $organization, $data);
|
||||
} elseif (($validated['type'] ?? '') === 'webinar') {
|
||||
abort_if($isInstant, 422, 'Webinars must be scheduled.');
|
||||
$room = $this->rooms->create($request->user(), $organization, array_merge($data, [
|
||||
'type' => 'webinar',
|
||||
'status' => 'scheduled',
|
||||
]));
|
||||
} elseif (($validated['type'] ?? '') === 'town_hall') {
|
||||
abort_if($isInstant, 422, 'Town halls must be scheduled.');
|
||||
$room = $this->rooms->create($request->user(), $organization, array_merge($data, [
|
||||
@@ -163,6 +158,10 @@ class RoomController extends Controller
|
||||
$this->authorizeAbility($request, 'meetings.view');
|
||||
$this->authorizeOwner($request, $room);
|
||||
|
||||
if ($room->isWebinar()) {
|
||||
return redirect()->route('meet.webinars.show', $room);
|
||||
}
|
||||
|
||||
$room->load(['sessions.participants', 'invitations', 'sessions.recordings', 'sessions.aiSummaries', 'sessionFiles', 'webinarRegistrations']);
|
||||
|
||||
return view('meet.rooms.show', compact('room'));
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Meet;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Meet\Concerns\ScopesToAccount;
|
||||
use App\Models\Room;
|
||||
use App\Models\Template;
|
||||
use App\Services\Meet\CalendarService;
|
||||
use App\Services\Meet\InvitationService;
|
||||
use App\Services\Meet\RoomService;
|
||||
use App\Services\Meet\SessionService;
|
||||
use App\Services\Meet\TemplateService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class WebinarController extends Controller
|
||||
{
|
||||
use ScopesToAccount;
|
||||
|
||||
public function __construct(
|
||||
protected RoomService $rooms,
|
||||
protected SessionService $sessions,
|
||||
protected TemplateService $templates,
|
||||
protected InvitationService $invitations,
|
||||
protected CalendarService $calendar,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
{
|
||||
$this->authorizeAbility($request, 'meetings.view');
|
||||
$organization = $this->organization($request);
|
||||
$owner = $this->ownerRef($request);
|
||||
|
||||
$query = Room::owned($owner)
|
||||
->where('organization_id', $organization->id)
|
||||
->where('type', 'webinar');
|
||||
|
||||
$this->scopeToBranch($request, $query);
|
||||
|
||||
$webinars = $query->orderByDesc('scheduled_at')->paginate(20);
|
||||
|
||||
return view('meet.webinars.index', compact('webinars', 'organization'));
|
||||
}
|
||||
|
||||
public function create(Request $request): View
|
||||
{
|
||||
$this->authorizeAbility($request, 'meetings.create');
|
||||
$organization = $this->organization($request);
|
||||
|
||||
$templates = Template::owned($this->ownerRef($request))
|
||||
->where('organization_id', $organization->id)
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
return view('meet.webinars.create', [
|
||||
'organization' => $organization,
|
||||
'templates' => $templates,
|
||||
'timezones' => timezone_identifiers_list(),
|
||||
'defaultSettings' => config('meet.default_settings'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
$this->authorizeAbility($request, 'meetings.create');
|
||||
$organization = $this->organization($request);
|
||||
|
||||
$validated = $request->validate([
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string', 'max:2000'],
|
||||
'scheduled_at' => ['required', 'date'],
|
||||
'duration_minutes' => ['nullable', 'integer', 'min:15', 'max:480'],
|
||||
'timezone' => ['nullable', 'timezone'],
|
||||
'passcode' => ['nullable', 'string', 'max:20'],
|
||||
'template_id' => ['nullable', 'integer', 'exists:meet_templates,id'],
|
||||
'invite_emails' => ['nullable', 'string'],
|
||||
'waiting_room' => ['sometimes', 'boolean'],
|
||||
'join_before_host' => ['sometimes', 'boolean'],
|
||||
'mute_on_join' => ['sometimes', 'boolean'],
|
||||
'auto_record' => ['sometimes', 'boolean'],
|
||||
'live_captions' => ['sometimes', 'boolean'],
|
||||
'webinar_auto_approve' => ['sometimes', 'boolean'],
|
||||
]);
|
||||
|
||||
$settings = [
|
||||
'waiting_room' => $request->boolean('waiting_room', true),
|
||||
'join_before_host' => $request->boolean('join_before_host'),
|
||||
'mute_on_join' => $request->boolean('mute_on_join', true),
|
||||
'auto_record' => $request->boolean('auto_record'),
|
||||
'live_captions' => $request->boolean('live_captions'),
|
||||
'webinar_auto_approve' => $request->boolean('webinar_auto_approve'),
|
||||
'stage_mode' => true,
|
||||
];
|
||||
|
||||
$data = array_merge($validated, [
|
||||
'settings' => $settings,
|
||||
'timezone' => $validated['timezone'] ?? $organization->timezone,
|
||||
'type' => 'webinar',
|
||||
'status' => 'scheduled',
|
||||
]);
|
||||
|
||||
if (! empty($validated['template_id'])) {
|
||||
$template = Template::findOrFail($validated['template_id']);
|
||||
$data = $this->templates->applyToRoomData($template, $data);
|
||||
}
|
||||
|
||||
$room = $this->rooms->create($request->user(), $organization, $data);
|
||||
|
||||
if ($emails = trim((string) ($validated['invite_emails'] ?? ''))) {
|
||||
$invites = collect(preg_split('/[\s,;]+/', $emails))
|
||||
->filter()
|
||||
->map(fn ($email) => ['email' => $email])
|
||||
->all();
|
||||
$this->invitations->inviteToRoom($room, $invites, $request->user());
|
||||
}
|
||||
|
||||
if ($room->scheduled_at) {
|
||||
$this->calendar->syncRoomCreated($room, $request->user());
|
||||
}
|
||||
|
||||
return redirect()->route('meet.webinars.show', $room)->with('success', 'Webinar created.');
|
||||
}
|
||||
|
||||
public function show(Request $request, Room $room): View
|
||||
{
|
||||
$this->authorizeAbility($request, 'meetings.view');
|
||||
$this->authorizeOwner($request, $room);
|
||||
abort_unless($room->isWebinar(), 404);
|
||||
|
||||
$room->load(['sessions.participants', 'invitations', 'sessions.recordings', 'sessions.aiSummaries', 'sessionFiles', 'webinarRegistrations']);
|
||||
|
||||
return view('meet.webinars.show', compact('room'));
|
||||
}
|
||||
|
||||
public function start(Request $request, Room $room): RedirectResponse
|
||||
{
|
||||
$this->authorizeAbility($request, 'meetings.host');
|
||||
$this->authorizeOwner($request, $room);
|
||||
abort_unless($room->isWebinar(), 404);
|
||||
|
||||
if ($room->status === 'cancelled') {
|
||||
return redirect()->route('meet.webinars.show', $room)
|
||||
->withErrors(['start' => 'Webinar was cancelled.']);
|
||||
}
|
||||
|
||||
$session = $this->sessions->start($room, $request->user());
|
||||
|
||||
$participant = $this->sessions->joinedParticipantForUser($session, $request->user());
|
||||
abort_unless($participant, 500, 'Unable to join as host.');
|
||||
|
||||
$this->sessions->rememberParticipantSession($request, $participant, $session);
|
||||
|
||||
return redirect()->route('meet.room', $session);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user