Files
hoshpoint-backend/app/Models/TemplateKey.php
soheil khaledabadi 46ae711a20 feat(api): add AI text-to-deck generation, wallet deposit structure, and profile/notification endpoints
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>
2026-08-29 01:36:17 +03:30

56 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use App\Enums\TemplateKeyType;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
#[Fillable([
'template_id',
'key',
'label',
'type',
'shape_name',
'is_required',
'is_repeatable',
'sort_order',
'description',
])]
class TemplateKey extends Model
{
/**
* @return BelongsTo<Template, $this>
*/
public function template(): BelongsTo
{
return $this->belongsTo(Template::class);
}
/**
* Strip any literal curly braces the admin may have copied from the pptx placeholder
* (e.g. "{Main Title}" -> "Main Title"), since braces are added automatically at match time.
*/
protected function key(): Attribute
{
return Attribute::make(
set: fn (string $value) => trim($value, "{} \t\n\r\0\x0B"),
);
}
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'type' => TemplateKeyType::class,
'is_required' => 'boolean',
'is_repeatable' => 'boolean',
'sort_order' => 'integer',
];
}
}