Phases 0–18: core meetings, webinar, breakouts, team chat, live streaming, town hall, billing, and Ladill Mail calendar wiring. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Meet;
|
||||
|
||||
use App\Models\Organization;
|
||||
use App\Models\Template;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TemplateService
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $data
|
||||
*/
|
||||
public function create(User $user, Organization $organization, array $data): Template
|
||||
{
|
||||
if ($data['is_default'] ?? false) {
|
||||
Template::owned($user->ownerRef())
|
||||
->where('organization_id', $organization->id)
|
||||
->update(['is_default' => false]);
|
||||
}
|
||||
|
||||
return Template::create([
|
||||
'owner_ref' => $user->ownerRef(),
|
||||
'organization_id' => $organization->id,
|
||||
'name' => $data['name'],
|
||||
'description' => $data['description'] ?? null,
|
||||
'duration_minutes' => $data['duration_minutes'] ?? 60,
|
||||
'settings' => array_merge(config('meet.default_settings'), $data['settings'] ?? []),
|
||||
'is_default' => (bool) ($data['is_default'] ?? false),
|
||||
]);
|
||||
}
|
||||
|
||||
public function applyToRoomData(Template $template, array $data): array
|
||||
{
|
||||
return array_merge($data, [
|
||||
'duration_minutes' => $data['duration_minutes'] ?? $template->duration_minutes,
|
||||
'settings' => array_merge($template->mergedSettings(), $data['settings'] ?? []),
|
||||
'template_id' => $template->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user