Implemented a block editor for changing the layout of the page

This commit is contained in:
2026-04-04 01:17:05 +02:00
parent 0800f7664f
commit ff58e82497
41 changed files with 2706 additions and 298 deletions

56
app/Models/PageBlock.php Normal file
View File

@@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PageBlock extends Model
{
public const TYPES = [
'hero',
'image',
'benefits',
'social_proof',
'form',
'countdown',
'text',
'cta_banner',
'divider',
];
protected $fillable = [
'preregistration_page_id',
'type',
'content',
'sort_order',
'is_visible',
];
protected function casts(): array
{
return [
'content' => 'array',
'is_visible' => 'boolean',
];
}
public function preregistrationPage(): BelongsTo
{
return $this->belongsTo(PreregistrationPage::class);
}
/**
* Blade dynamic component name (kebab-case where needed).
*/
public function bladeComponentName(): string
{
return match ($this->type) {
'social_proof' => 'blocks.social-proof',
'cta_banner' => 'blocks.cta-banner',
default => 'blocks.'.$this->type,
};
}
}