First commit
This commit is contained in:
commit
7cf3558ba7
12933 changed files with 1180047 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('flux_cms_pages', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('domain_key')->index();
|
||||
$table->json('title'); // Übersetzbarer Seitentitel
|
||||
$table->json('meta_description')->nullable(); // SEO Meta Description
|
||||
$table->json('meta_keywords')->nullable(); // SEO Keywords
|
||||
$table->json('og_image')->nullable(); // Open Graph Image (Media Library Reference)
|
||||
$table->string('canonical_url')->nullable(); // SEO Canonical URL
|
||||
$table->json('settings')->nullable(); // Zusätzliche Einstellungen
|
||||
$table->boolean('is_published')->default(true);
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
// Composite indexes for performance
|
||||
$table->index(['domain_key', 'is_published']);
|
||||
$table->index(['domain_key', 'is_published', 'published_at']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flux_cms_pages');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('flux_cms_page_components', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('page_id')->constrained('flux_cms_pages')->onDelete('cascade');
|
||||
$table->string('component_class'); // Full namespace of the component class
|
||||
$table->integer('order')->default(0);
|
||||
$table->json('content'); // Alle übersetzten Inhalte der Komponente
|
||||
$table->json('settings')->nullable(); // Komponenten-spezifische Einstellungen
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
// Indexes for performance
|
||||
$table->index(['page_id', 'order']);
|
||||
$table->index(['page_id', 'is_active']);
|
||||
$table->index(['component_class']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flux_cms_page_components');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('flux_cms_page_versions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('page_id')->constrained('flux_cms_pages')->onDelete('cascade');
|
||||
$table->json('page_data'); // Snapshot der kompletten Seite
|
||||
$table->json('components_data'); // Snapshot aller Komponenten
|
||||
$table->string('version_name')->nullable(); // Benutzerdefinierter Name
|
||||
$table->text('change_description')->nullable(); // Was wurde geändert
|
||||
$table->string('created_by_type')->nullable(); // Polymorphic relation type
|
||||
$table->unsignedBigInteger('created_by_id')->nullable(); // Polymorphic relation id
|
||||
$table->timestamps();
|
||||
|
||||
// Indexes
|
||||
$table->index('page_id');
|
||||
$table->index(['page_id', 'created_at']);
|
||||
$table->index(['created_by_type', 'created_by_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flux_cms_page_versions');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('flux_cms_navigations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('domain_key')->index();
|
||||
$table->string('name'); // z.B. 'main', 'footer', 'sidebar'
|
||||
$table->json('display_name'); // Übersetzbarer Anzeigename
|
||||
$table->json('settings')->nullable(); // Navigation-spezifische Einstellungen
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
// Unique constraint
|
||||
$table->unique(['domain_key', 'name']);
|
||||
$table->index(['domain_key', 'is_active']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flux_cms_navigations');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('flux_cms_navigation_items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('navigation_id')->constrained('flux_cms_navigations')->onDelete('cascade');
|
||||
$table->foreignId('page_id')->nullable()->constrained('flux_cms_pages')->onDelete('cascade');
|
||||
$table->string('external_url')->nullable();
|
||||
$table->json('label'); // Übersetzbarer Menütext
|
||||
$table->integer('order')->default(0);
|
||||
$table->foreignId('parent_id')->nullable()->constrained('flux_cms_navigation_items')->onDelete('cascade');
|
||||
$table->json('settings')->nullable(); // Item-spezifische Einstellungen
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->boolean('opens_in_new_tab')->default(false);
|
||||
$table->timestamps();
|
||||
|
||||
// Indexes
|
||||
$table->index(['navigation_id', 'order']);
|
||||
$table->index(['navigation_id', 'parent_id']);
|
||||
$table->index(['navigation_id', 'is_active']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flux_cms_navigation_items');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('flux_cms_blog_posts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('domain_key')->index();
|
||||
$table->json('title'); // Übersetzbarer Titel
|
||||
$table->json('excerpt')->nullable(); // Übersetzbarer Kurztext
|
||||
$table->json('content'); // Übersetzbarer Haupttext
|
||||
$table->json('meta_description')->nullable(); // SEO
|
||||
$table->json('meta_keywords')->nullable(); // SEO
|
||||
$table->json('og_image')->nullable(); // Open Graph Image
|
||||
$table->json('settings')->nullable(); // Post-spezifische Einstellungen
|
||||
$table->boolean('is_published')->default(false);
|
||||
$table->boolean('is_featured')->default(false);
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->string('author_type')->nullable(); // Polymorphic relation type
|
||||
$table->unsignedBigInteger('author_id')->nullable(); // Polymorphic relation id
|
||||
$table->timestamps();
|
||||
|
||||
// Indexes
|
||||
$table->index(['domain_key', 'is_published']);
|
||||
$table->index(['domain_key', 'is_published', 'published_at']);
|
||||
$table->index(['domain_key', 'is_featured']);
|
||||
$table->index(['author_type', 'author_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flux_cms_blog_posts');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->json('name');
|
||||
$table->json('slug');
|
||||
$table->string('type')->nullable();
|
||||
$table->integer('order_column')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('taggables', function (Blueprint $table) {
|
||||
$table->foreignId('tag_id')->constrained()->cascadeOnDelete();
|
||||
$table->morphs('taggable');
|
||||
$table->unique(['tag_id', 'taggable_id', 'taggable_type']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('taggables');
|
||||
Schema::dropIfExists('tags');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('flux_cms_slugs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('model');
|
||||
$table->string('locale')->index();
|
||||
$table->string('slug');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['locale', 'slug']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('flux_cms_slugs');
|
||||
}
|
||||
};
|
||||
175
packages/flux-cms/core/database/seeders/CmsContentSeeder.php
Normal file
175
packages/flux-cms/core/database/seeders/CmsContentSeeder.php
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<?php
|
||||
|
||||
namespace FluxCms\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use FluxCms\Core\Models\Page;
|
||||
use FluxCms\Core\Models\BlogPost;
|
||||
|
||||
class CmsContentSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->createSamplePages();
|
||||
$this->createSampleBlogPosts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create sample pages
|
||||
*/
|
||||
protected function createSamplePages(): void
|
||||
{
|
||||
// Homepage
|
||||
$homepage = Page::create([
|
||||
'domain_key' => 'default',
|
||||
'title' => [
|
||||
'de' => 'Willkommen auf unserer Website',
|
||||
'en' => 'Welcome to our Website'
|
||||
],
|
||||
'slug' => [
|
||||
'de' => '/',
|
||||
'en' => '/'
|
||||
],
|
||||
'meta_description' => [
|
||||
'de' => 'Willkommen auf unserer modernen Website, erstellt mit Flux CMS.',
|
||||
'en' => 'Welcome to our modern website, built with Flux CMS.'
|
||||
],
|
||||
'meta_keywords' => [
|
||||
'de' => 'Website, CMS, Flux CMS, Laravel',
|
||||
'en' => 'Website, CMS, Flux CMS, Laravel'
|
||||
],
|
||||
'is_published' => true,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
// About page
|
||||
$aboutPage = Page::create([
|
||||
'domain_key' => 'default',
|
||||
'title' => [
|
||||
'de' => 'Über uns',
|
||||
'en' => 'About us'
|
||||
],
|
||||
'slug' => [
|
||||
'de' => '/ueber-uns',
|
||||
'en' => '/about'
|
||||
],
|
||||
'meta_description' => [
|
||||
'de' => 'Erfahren Sie mehr über unser Unternehmen und unsere Mission.',
|
||||
'en' => 'Learn more about our company and our mission.'
|
||||
],
|
||||
'is_published' => true,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
// Contact page
|
||||
$contactPage = Page::create([
|
||||
'domain_key' => 'default',
|
||||
'title' => [
|
||||
'de' => 'Kontakt',
|
||||
'en' => 'Contact'
|
||||
],
|
||||
'slug' => [
|
||||
'de' => '/kontakt',
|
||||
'en' => '/contact'
|
||||
],
|
||||
'meta_description' => [
|
||||
'de' => 'Kontaktieren Sie uns für weitere Informationen.',
|
||||
'en' => 'Contact us for more information.'
|
||||
],
|
||||
'is_published' => true,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$this->command->info('Sample pages created successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create sample blog posts
|
||||
*/
|
||||
protected function createSampleBlogPosts(): void
|
||||
{
|
||||
$posts = [
|
||||
[
|
||||
'title' => [
|
||||
'de' => 'Willkommen bei Flux CMS',
|
||||
'en' => 'Welcome to Flux CMS'
|
||||
],
|
||||
'slug' => [
|
||||
'de' => 'willkommen-bei-flux-cms',
|
||||
'en' => 'welcome-to-flux-cms'
|
||||
],
|
||||
'excerpt' => [
|
||||
'de' => 'Flux CMS ist ein modernes, komponentenbasiertes Content Management System für Laravel.',
|
||||
'en' => 'Flux CMS is a modern, component-based Content Management System for Laravel.'
|
||||
],
|
||||
'content' => [
|
||||
'de' => '<p>Flux CMS revolutioniert die Art, wie Sie Inhalte verwalten. Mit seiner einzigartigen "Code-as-Schema" Philosophie definieren Sie Inhaltsstrukturen direkt in PHP-Komponenten.</p><p>Dies bietet beispiellose Flexibilität und eine hervorragende Entwicklererfahrung.</p>',
|
||||
'en' => '<p>Flux CMS revolutionizes the way you manage content. With its unique "Code-as-Schema" philosophy, you define content structures directly in PHP components.</p><p>This offers unprecedented flexibility and an excellent developer experience.</p>'
|
||||
],
|
||||
'category' => 'News',
|
||||
'tags' => ['CMS', 'Laravel', 'Flux'],
|
||||
'is_published' => true,
|
||||
'is_featured' => true,
|
||||
'published_at' => now()->subDays(1),
|
||||
],
|
||||
[
|
||||
'title' => [
|
||||
'de' => 'Multi-Domain Support',
|
||||
'en' => 'Multi-Domain Support'
|
||||
],
|
||||
'slug' => [
|
||||
'de' => 'multi-domain-support',
|
||||
'en' => 'multi-domain-support'
|
||||
],
|
||||
'excerpt' => [
|
||||
'de' => 'Verwalten Sie mehrere Websites von einer Installation aus.',
|
||||
'en' => 'Manage multiple websites from one installation.'
|
||||
],
|
||||
'content' => [
|
||||
'de' => '<p>Mit Flux CMS können Sie mehrere Domains von einer einzigen Installation aus verwalten. Jede Domain kann ihre eigenen Inhalte, Designs und Einstellungen haben.</p>',
|
||||
'en' => '<p>With Flux CMS, you can manage multiple domains from a single installation. Each domain can have its own content, designs, and settings.</p>'
|
||||
],
|
||||
'category' => 'Features',
|
||||
'tags' => ['Multi-Domain', 'Features'],
|
||||
'is_published' => true,
|
||||
'is_featured' => false,
|
||||
'published_at' => now()->subDays(2),
|
||||
],
|
||||
[
|
||||
'title' => [
|
||||
'de' => 'Komponenten-First Architektur',
|
||||
'en' => 'Component-First Architecture'
|
||||
],
|
||||
'slug' => [
|
||||
'de' => 'komponenten-first-architektur',
|
||||
'en' => 'component-first-architecture'
|
||||
],
|
||||
'excerpt' => [
|
||||
'de' => 'Bauen Sie Seiten aus wiederverwendbaren Livewire-Komponenten.',
|
||||
'en' => 'Build pages from reusable Livewire components.'
|
||||
],
|
||||
'content' => [
|
||||
'de' => '<p>Die Komponenten-First Architektur von Flux CMS ermöglicht es Ihnen, komplexe Seiten aus kleinen, wiederverwendbaren Komponenten zu erstellen.</p><p>Jede Komponente kann ihre eigenen Felder und Validierungsregeln definieren.</p>',
|
||||
'en' => '<p>The component-first architecture of Flux CMS allows you to create complex pages from small, reusable components.</p><p>Each component can define its own fields and validation rules.</p>'
|
||||
],
|
||||
'category' => 'Architecture',
|
||||
'tags' => ['Components', 'Livewire', 'Architecture'],
|
||||
'is_published' => true,
|
||||
'is_featured' => false,
|
||||
'published_at' => now()->subDays(3),
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($posts as $postData) {
|
||||
BlogPost::create(array_merge($postData, [
|
||||
'domain_key' => 'default',
|
||||
'author_id' => 1, // Assuming user ID 1 exists
|
||||
]));
|
||||
}
|
||||
|
||||
$this->command->info('Sample blog posts created successfully!');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
namespace FluxCms\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class CmsPermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->createPermissions();
|
||||
$this->createRoles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create CMS permissions
|
||||
*/
|
||||
protected function createPermissions(): void
|
||||
{
|
||||
$permissions = [
|
||||
'flux-cms.view' => 'View CMS content',
|
||||
'flux-cms.edit' => 'Edit CMS content',
|
||||
'flux-cms.publish' => 'Publish CMS content',
|
||||
'flux-cms.delete' => 'Delete CMS content',
|
||||
'flux-cms.admin' => 'Administer CMS',
|
||||
];
|
||||
|
||||
foreach ($permissions as $name => $description) {
|
||||
Permission::firstOrCreate(
|
||||
['name' => $name],
|
||||
['description' => $description]
|
||||
);
|
||||
}
|
||||
|
||||
$this->command->info('CMS permissions created successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create CMS roles
|
||||
*/
|
||||
protected function createRoles(): void
|
||||
{
|
||||
// Create CMS Editor role
|
||||
$editorRole = Role::firstOrCreate(['name' => 'flux-cms-editor']);
|
||||
$editorRole->syncPermissions([
|
||||
'flux-cms.view',
|
||||
'flux-cms.edit',
|
||||
]);
|
||||
|
||||
// Create CMS Publisher role
|
||||
$publisherRole = Role::firstOrCreate(['name' => 'flux-cms-publisher']);
|
||||
$publisherRole->syncPermissions([
|
||||
'flux-cms.view',
|
||||
'flux-cms.edit',
|
||||
'flux-cms.publish',
|
||||
]);
|
||||
|
||||
// Create CMS Admin role
|
||||
$adminRole = Role::firstOrCreate(['name' => 'flux-cms-admin']);
|
||||
$adminRole->syncPermissions([
|
||||
'flux-cms.view',
|
||||
'flux-cms.edit',
|
||||
'flux-cms.publish',
|
||||
'flux-cms.delete',
|
||||
'flux-cms.admin',
|
||||
]);
|
||||
|
||||
// Create general CMS role (for backward compatibility)
|
||||
$cmsRole = Role::firstOrCreate(['name' => 'flux-cms']);
|
||||
$cmsRole->syncPermissions([
|
||||
'flux-cms.view',
|
||||
'flux-cms.edit',
|
||||
'flux-cms.publish',
|
||||
'flux-cms.delete',
|
||||
'flux-cms.admin',
|
||||
]);
|
||||
|
||||
$this->command->info('CMS roles created successfully!');
|
||||
$this->command->info('Available roles: flux-cms-editor, flux-cms-publisher, flux-cms-admin, flux-cms');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue