Add template preview functionality: Introduced TemplatePreviewController and TemplatePreviewService for rendering dynamic previews of header, footer, and section templates. Updated form schemas to include preview components and enhanced real-time content updates. Added configuration for template assets and integrated preview functionality into the admin panel.

This commit is contained in:
Ümit Tunç
2025-10-31 16:48:36 -03:00
parent 67d8b4c781
commit 52c4ba1b19
8 changed files with 578 additions and 9 deletions
@@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers;
use App\Services\TemplatePreviewService;
use Illuminate\Http\Request;
class TemplatePreviewController extends Controller
{
/**
* Render template preview
*
* @param Request $request
* @return \Illuminate\View\View
*/
public function preview(Request $request)
{
$content = $request->input('content', '');
$type = $request->input('type', 'section'); // header, footer, section
// Validate type
if (!in_array($type, ['header', 'footer', 'section'])) {
$type = 'section';
}
$html = TemplatePreviewService::getPreviewHtml($content, $type);
return response($html)
->header('Content-Type', 'text/html; charset=utf-8');
}
}