Ergaenze Stammdaten, Suche, Dimensionen, Abdeckung und Ausgabenachweis
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
7b54c38623
commit
5e763d15ec
23 files changed
+661
-5
No files matched your search
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('editorial_dimensions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('slug')->unique();
|
||||
$table->string('label');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('editorial_dimension_values', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('editorial_dimension_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('slug');
|
||||
$table->string('label');
|
||||
$table->timestamps();
|
||||
$table->unique(['editorial_dimension_id', 'slug']);
|
||||
});
|
||||
|
||||
Schema::create('identity_dimension_values', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('subject_type');
|
||||
$table->unsignedBigInteger('subject_id');
|
||||
$table->foreignId('editorial_dimension_value_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('origin');
|
||||
$table->timestamps();
|
||||
$table->unique(['subject_type', 'subject_id', 'editorial_dimension_value_id'], 'identity_dimension_unique');
|
||||
});
|
||||
|
||||
$now = now();
|
||||
$dimensionId = DB::table('editorial_dimensions')->insertGetId([
|
||||
'slug' => 'saeule',
|
||||
'label' => 'Fachliche Säule',
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
foreach (DB::table('pillars')->orderBy('id')->get() as $pillar) {
|
||||
$slug = 'pfeiler-'.$pillar->id;
|
||||
$valueId = DB::table('editorial_dimension_values')->insertGetId([
|
||||
'editorial_dimension_id' => $dimensionId,
|
||||
'slug' => $slug,
|
||||
'label' => $pillar->name,
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
foreach (DB::table('content_element_pillar')->where('pillar_id', $pillar->id)->get() as $link) {
|
||||
DB::table('identity_dimension_values')->insert([
|
||||
'subject_type' => 'App\\Domain\\Catalog\\ContentElement',
|
||||
'subject_id' => $link->content_element_id,
|
||||
'editorial_dimension_value_id' => $valueId,
|
||||
'origin' => 'direkt',
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('identity_dimension_values');
|
||||
Schema::dropIfExists('editorial_dimension_values');
|
||||
Schema::dropIfExists('editorial_dimensions');
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user