Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up()
{
Schema::table('webinars', function (Blueprint $table) {
$table->boolean('analyze_enabled')->default(false);
});
}

public function down()
{
Schema::table('webinars', function (Blueprint $table) {
$table->dropColumn('analyze_enabled');
});
}
};
4 changes: 2 additions & 2 deletions src/Dto/Traits/DtoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ 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
{
$result = [];
foreach ($fillables as $fill) {
$value = $this->getterByAttribute($fill);
if ($value === false) {
if ($value === null) {
continue;
}
$result[$fill] = $value;
Expand Down
10 changes: 8 additions & 2 deletions src/Dto/WebinarDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -83,4 +84,9 @@ protected function setActiveFrom(?string $activeFrom): void
{
$this->activeFrom = Carbon::make($activeFrom);
}

public function setAnalyzeEnabled(?bool $analyzeEnabled): void
{
$this->analyzeEnabled = $analyzeEnabled;
}
}
2 changes: 1 addition & 1 deletion src/Enum/ConstantEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions src/Http/Requests/StoreWebinarRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function rules(): array
'image' => ['nullable', 'file', 'image'],
'trainers' => ['array'],
'trainers.*' => ['integer', 'exists:users,id'],
'analyze_enabled' => ['boolean', 'nullable'],
];
}
}
1 change: 1 addition & 0 deletions src/Http/Requests/UpdateWebinarRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function rules(): array
'trainers.*' => ['integer', 'exists:users,id'],
'tags' => ['array'],
'tags.*' => ['string'],
'analyze_enabled' => ['boolean', 'nullable'],
];
}

Expand Down
1 change: 1 addition & 0 deletions src/Http/Resources/WebinarSimpleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 6 additions & 0 deletions src/Models/Webinar.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@
* description="yt_stream_key",
* type="string",
* ),
* @OA\Property(
* property="analyze_enabled",
* description="analyze_enabled",
* type="bool",
* ),
* )
*
* @property string $status
Expand Down Expand Up @@ -136,6 +141,7 @@ class Webinar extends Model
'active_from',
'active_to',
'reminder_status',
'analyze_enabled',
];

public function trainers(): BelongsToMany
Expand Down
Loading