Fills the gaps between the admin panel screens and the backend: a full free-text + slide-count + language -> AI-generated presentation flow with new slide-cloning logic in TemplateFillService, a "my presentations" list endpoint, a swappable payment-gateway structure for wallet top-ups (fake driver for now), and avatar upload / public-profile toggle / account deletion / password change / notification preference endpoints. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
68 lines
1.4 KiB
PHP
68 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
#[Fillable([
|
|
'category_id',
|
|
'title',
|
|
'slug',
|
|
'description',
|
|
'file_path',
|
|
'thumbnail_path',
|
|
'is_active',
|
|
'is_ai_enabled',
|
|
'ai_repeatable_slide_number',
|
|
'created_by',
|
|
])]
|
|
class Template extends Model
|
|
{
|
|
/**
|
|
* @return BelongsTo<Category, $this>
|
|
*/
|
|
public function category(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Category::class);
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<User, $this>
|
|
*/
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
/**
|
|
* @return HasMany<TemplateKey, $this>
|
|
*/
|
|
public function keys(): HasMany
|
|
{
|
|
return $this->hasMany(TemplateKey::class)->orderBy('sort_order');
|
|
}
|
|
|
|
/**
|
|
* @return HasMany<TemplateGeneration, $this>
|
|
*/
|
|
public function generations(): HasMany
|
|
{
|
|
return $this->hasMany(TemplateGeneration::class)->latest();
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'is_active' => 'boolean',
|
|
'is_ai_enabled' => 'boolean',
|
|
'ai_repeatable_slide_number' => 'integer',
|
|
];
|
|
}
|
|
}
|