chore: update composer dependencies to include phppresentation chore: update composer.lock after adding phppresentation feat: create categories migration for category management feat: create templates migration for template storage feat: create template generations migration for tracking template usage feat: create template keys migration for template customization feat: create notifications migration for user notifications feat: update API routes for categories, templates, and user profile management docs: update API documentation to include new endpoints for profile and wallet
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\TemplateKey;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use OpenApi\Attributes as OA;
|
|
|
|
#[OA\Schema(
|
|
schema: 'TemplateKey',
|
|
properties: [
|
|
new OA\Property(property: 'key', type: 'string', example: 'title'),
|
|
new OA\Property(property: 'label', type: 'string', example: 'عنوان اسلاید'),
|
|
new OA\Property(property: 'type', type: 'string', example: 'text'),
|
|
new OA\Property(property: 'type_label', type: 'string', example: 'متن'),
|
|
new OA\Property(property: 'is_required', type: 'boolean', example: true),
|
|
new OA\Property(property: 'description', type: 'string', example: 'عنوان اصلی اسلاید نخست', nullable: true),
|
|
]
|
|
)]
|
|
/** @mixin TemplateKey */
|
|
class TemplateKeyResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'key' => $this->key,
|
|
'label' => $this->label,
|
|
'type' => $this->type->value,
|
|
'type_label' => $this->type->label(),
|
|
'is_required' => $this->is_required,
|
|
'description' => $this->description,
|
|
];
|
|
}
|
|
}
|