feat: add theme

This commit is contained in:
2026-06-14 15:06:11 +03:30
parent fb17f4c08b
commit b1e39dfabf
8 changed files with 258 additions and 7 deletions
+7 -1
View File
@@ -3,16 +3,22 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Scene extends Model
{
protected $fillable = ['name', 'image_path', 'video_path', 'sound_path', 'order', 'is_active'];
protected $fillable = ['theme_id', 'name', 'image_path', 'video_path', 'sound_path', 'order', 'is_active'];
protected $casts = [
'is_active' => 'boolean',
'order' => 'integer',
];
public function theme(): BelongsTo
{
return $this->belongsTo(Theme::class);
}
protected $appends = ['image_url', 'video_url', 'sound_url', 'has_video'];
public function getImageUrlAttribute(): ?string
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Theme extends Model
{
protected $fillable = ['key', 'name', 'colors', 'order', 'is_active'];
protected $casts = [
'colors' => 'array',
'is_active' => 'boolean',
'order' => 'integer',
];
public function scenes(): HasMany
{
return $this->hasMany(Scene::class);
}
}