diff --git a/database/migrations/2026_04_13_125120_added_analyze_enabled_to_webinars_table.php b/database/migrations/2026_04_13_125120_added_analyze_enabled_to_webinars_table.php new file mode 100644 index 0000000..b6aa2cc --- /dev/null +++ b/database/migrations/2026_04_13_125120_added_analyze_enabled_to_webinars_table.php @@ -0,0 +1,22 @@ +boolean('analyze_enabled')->default(false); + }); + } + + public function down() + { + Schema::table('webinars', function (Blueprint $table) { + $table->dropColumn('analyze_enabled'); + }); + } +}; diff --git a/src/Dto/Traits/DtoHelper.php b/src/Dto/Traits/DtoHelper.php index 4f21ecb..d00d1a4 100644 --- a/src/Dto/Traits/DtoHelper.php +++ b/src/Dto/Traits/DtoHelper.php @@ -30,7 +30,7 @@ protected function getterByAttribute(string $attribute) if (method_exists($this, 'get' . $key)) { return $this->{'get' . $key}(); } - return $this->{lcfirst($key)} ?? false; + return $this->{lcfirst($key)} ?? null; } protected function fillInArray(array $fillables): array @@ -38,7 +38,7 @@ protected function fillInArray(array $fillables): array $result = []; foreach ($fillables as $fill) { $value = $this->getterByAttribute($fill); - if ($value === false) { + if ($value === null) { continue; } $result[$fill] = $value; diff --git a/src/Dto/WebinarDto.php b/src/Dto/WebinarDto.php index 1de530d..1deb8c8 100644 --- a/src/Dto/WebinarDto.php +++ b/src/Dto/WebinarDto.php @@ -19,8 +19,9 @@ class WebinarDto extends BaseDto implements ModelDtoContract protected ?string $activeFrom; protected ?string $duration; protected ?int $basePrice; - protected $imagePath = false; - protected $logotypePath = false; + protected $imagePath = null; + protected $logotypePath = null; + protected ?bool $analyzeEnabled; public function model(): Webinar { @@ -83,4 +84,9 @@ protected function setActiveFrom(?string $activeFrom): void { $this->activeFrom = Carbon::make($activeFrom); } + + public function setAnalyzeEnabled(?bool $analyzeEnabled): void + { + $this->analyzeEnabled = $analyzeEnabled; + } } diff --git a/src/Enum/ConstantEnum.php b/src/Enum/ConstantEnum.php index 45a8a6c..e67a003 100644 --- a/src/Enum/ConstantEnum.php +++ b/src/Enum/ConstantEnum.php @@ -9,5 +9,5 @@ class ConstantEnum extends Enum public const PER_PAGE = 15; public const DIRECTORY = 'webinar'; public const REDIS_IMAGES_KEY = 'signed_urls_index'; - public const REDIS_IMAGES_TTL = 90; + public const REDIS_IMAGES_TTL = 20; } diff --git a/src/Http/Requests/StoreWebinarRequest.php b/src/Http/Requests/StoreWebinarRequest.php index 06865ca..37048ac 100644 --- a/src/Http/Requests/StoreWebinarRequest.php +++ b/src/Http/Requests/StoreWebinarRequest.php @@ -30,6 +30,7 @@ public function rules(): array 'image' => ['nullable', 'file', 'image'], 'trainers' => ['array'], 'trainers.*' => ['integer', 'exists:users,id'], + 'analyze_enabled' => ['boolean', 'nullable'], ]; } } diff --git a/src/Http/Requests/UpdateWebinarRequest.php b/src/Http/Requests/UpdateWebinarRequest.php index 0b9be62..10f0517 100644 --- a/src/Http/Requests/UpdateWebinarRequest.php +++ b/src/Http/Requests/UpdateWebinarRequest.php @@ -36,6 +36,7 @@ public function rules(): array 'trainers.*' => ['integer', 'exists:users,id'], 'tags' => ['array'], 'tags.*' => ['string'], + 'analyze_enabled' => ['boolean', 'nullable'], ]; } diff --git a/src/Http/Resources/WebinarSimpleResource.php b/src/Http/Resources/WebinarSimpleResource.php index d3dad90..8789090 100644 --- a/src/Http/Resources/WebinarSimpleResource.php +++ b/src/Http/Resources/WebinarSimpleResource.php @@ -32,6 +32,7 @@ public function toArray($request) 'yt_url' => $this->resource->yt_url, 'tags' => $this->resource->tags, 'deadline' => $this->resource->deadline, + 'analyze_enabled' => $this->resource->analyze_enabled, ]; return self::apply($fields, $this); } diff --git a/src/Models/Webinar.php b/src/Models/Webinar.php index 18f8d74..236d605 100644 --- a/src/Models/Webinar.php +++ b/src/Models/Webinar.php @@ -107,6 +107,11 @@ * description="yt_stream_key", * type="string", * ), + * @OA\Property( + * property="analyze_enabled", + * description="analyze_enabled", + * type="bool", + * ), * ) * * @property string $status @@ -136,6 +141,7 @@ class Webinar extends Model 'active_from', 'active_to', 'reminder_status', + 'analyze_enabled', ]; public function trainers(): BelongsToMany