wip controll and repair

This commit is contained in:
salam committed 2026-07-06 07:45:01 +02:00
1 parent 4a509c6a16
commit 3dd1dad42f
19 files changed
+182 -91

No files matched your search

+23 -19
View File
@@ -28,25 +28,26 @@ class CloneProjekt
* projekt_objekte_im_details
* projekt_objektes
*/
$news_project = $record->replicate();
$news_project->cloned_from_id = $record->id;
$news_project->save();
$NEW = $record->replicate();
$NEW->cloned_from_id = $record->id;
$NEW->save();
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $news_project->id, 'evaluation_gutachten' => 0]);
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $NEW->id, 'evaluation_gutachten' => 0]);
$res = ProjektObjekte::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $news_project->id;
$new->projekte_cloned_from_id = $row->id;
$new->projekte_id = $NEW->id;
$new->cloned_from_id = $row->id;
$new->save();
$res2 = ProjektObjekteImDetail::where('projekte_id', $record->id)->where('projekt_objekte_id', $row->id)->get();
foreach ($res2 as $row2) {
$new2 = $row2->replicate();
$new2->projekte_id = $news_project->id;
$new2->projekte_id = $NEW->id;
$new2->projekt_objekte_id = $new->id;
$new2->projekte_objekte_cloned_from_id = $row2->id;
$new2->cloned_from_id = $row2->id;
$new2->save();
}
}
@@ -54,37 +55,40 @@ class CloneProjekt
$res = ProjektAllgemeinflaechen::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $news_project->id;
$new->projekte_id = $NEW->id;
$new->cloned_from_id = $row->id;
$new->save();
}
$res = ProjektInhaltsverzeichnis::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $news_project->id;
$new->save();
}
$res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $news_project->id;
$new->projekte_id = $NEW->id;
$new->cloned_from_id = $row->id;
$new->save();
}
$res = ProjektMerkmale::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $news_project->id;
$new->projekte_id = $NEW->id;
$new->cloned_from_id = $row->id;
$new->save();
}
$res = ProjektMethode::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $news_project->id;
$new->projekte_id = $NEW->id;
$new->cloned_from_id = $row->id;
$new->save();
}
$res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $news_project->id;
$new->projekte_id = $NEW->id;
$new->cloned_from_id = $row->id;
$new->save();
}
}
+106 -54
View File
@@ -10,6 +10,7 @@ use App\Models\ProjektMethode;
use App\Models\ProjektObjekte;
use App\Models\ProjektObjekteImDetail;
use App\Models\ProjektPlatzhalter;
use Filament\Notifications\Notification;
class Reparieren
{
@@ -26,79 +27,130 @@ class Reparieren
* projekt_objekte_im_details
* projekt_objektes
*/
$ORIGINAL = $record->cloned_from_id;
$GEKLONT = $record->id;
$CLONED_FROM_ID = $record->cloned_from_id;
$ACTIVE_ID = $record->id;
if($ORIGINAL){
// überprüfe geklontes Projekt!
$originals = ProjektObjekte::where('projekte_id', $ORIGINAL)->get();
/**
* Ist geklonet
*/
if($CLONED_FROM_ID){
// Lösche alle geklonten "Objekte" ohne Verbindung zu Original
ProjektObjekte::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
// Überprüfe geklontes Projekt
$originals = ProjektObjekte::where('projekte_id', $CLONED_FROM_ID)->get();
foreach ($originals as $original) {
$check = ProjektObjekte::where('projekte_id', $GEKLONT)->where('top_nummer', $original->top_nummer)->get();
dd($check);
$check = ProjektObjekte::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', $original->id)->get();
if (! $check) {
/**
* Im original dazugekommen
* Im Original dazugekommen oder gelöscht
*/
$new = $original->replicate();
$new->projekte_id = $GEKLONT;
$new->projekte_id = $ACTIVE_ID;
$new->cloned_from_id = $CLONED_FROM_ID;
$new->save();
$res2 = ProjektObjekteImDetail::where('projekte_id', $ORIGINAL)->where('projekt_objekte_id', $original->id)->get();
// Lösche alle geklonten "Objekte im Detail" ohne Verbindung zu Original
ProjektObjekteImDetail::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
$res2 = ProjektObjekteImDetail::where('projekte_id', $CLONED_FROM_ID)->where('projekt_objekte_id', $original->id)->get();
foreach ($res2 as $row2) {
$check = ProjektObjekteImDetail::where('projekte_id', $GEKLONT)->where('raumart', $row2->raumart)->first();
$check = ProjektObjekteImDetail::where('projekte_id', $ACTIVE_ID)->where('raumart', $row2->raumart)->first();
if (! $check) {
$new2 = $row2->replicate();
$new2->projekte_id = $GEKLONT;
$new2->projekte_id = $ACTIVE_ID;
$new2->projekt_objekte_id = $new->id;
$new2->cloned_from_id = $row2->id;
$new2->save();
}
}
}
}
ProjektAllgemeinflaechen::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
$res = ProjektAllgemeinflaechen::where('projekte_id', $CLONED_FROM_ID)->get();
foreach ($res as $row) {
$check = ProjektAllgemeinflaechen::where('projekte_id', $ACTIVE_ID)->where('raumart', $original->raumart)->first();
if (! $check) {
$new = $row->replicate();
$new->projekte_id = $ACTIVE_ID;
$new->cloned_from_id = $row->id;
$new->save();
}
}
ProjektInhaltsverzeichnis::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
$res = ProjektInhaltsverzeichnis::where('projekte_id', $CLONED_FROM_ID)->get();
foreach ($res as $row) {
$check = ProjektInhaltsverzeichnis::where('projekte_id', $ACTIVE_ID)->where('inhaltsverzeichnis_id', $original->inhaltsverzeichnis_id)->first();
if (! $check) {
$new = $row->replicate();
$new->projekte_id = $ACTIVE_ID;
$new->cloned_from_id = $row->id;
$new->save();
}
}
ProjektMerkmale::where('projekte_id', $ACTIVE_ID)->where('cloned_from_id', 0)->where('added_manuel', 0)->delete();
$res = ProjektMerkmale::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$check = ProjektInhaltsverzeichnis::where('projekte_id', $ACTIVE_ID)->where('name', $original->name)->first();
if (! $check) {
$new = $row->replicate();
$new->projekte_id = $ACTIVE_ID;
$new->cloned_from_id = $row->id;
$new->save();
}
}
$res = ProjektMethode::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $record->id;
$new->cloned_from_id = $row->id;
$new->save();
}
$res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
$new = $row->replicate();
$new->projekte_id = $record->id;
$new->cloned_from_id = $row->id;
$new->save();
}
}
// $res = ProjektAllgemeinflaechen::where('projekte_id', $original_id)->get();
// foreach ($res as $row) {
// $check = ProjektInhaltsverzeichnis::where('projekte_id', $original_id)->where('raumart', $original->raumart)->first();
// if (! $check) {
// $new = $row->replicate();
// $new->projekte_id = $record->id;
// $new->save();
// }
// }
// OBJEKTE IM DETAIL ZU OBJEKTE
// Kontrolliere Verbindungen geklonter und nicht geklonter
// Select all childreen from project
$res = ProjektObjekteImDetail::select('projekt_objekte_id')->where('projekte_id', $ACTIVE_ID)->groupBy('projekt_objekte_id')->get();
foreach ($res as $row) {
// See if parent exists
$res2 = ProjektObjekte::where('projekte_id', $ACTIVE_ID)->where('id', $row->projekt_objekte_id)->first();
if(!$res){
// If parent NOT exists delete all childreen
ProjektObjekteImDetail::where('projekte_id', $ACTIVE_ID)->where('projekt_objekte_id', $row->projekt_objekte_id)->delete();
}
}
// OBJEKTE ZU OBJEKTE IM DETAIL
$res = ProjektObjekte::where('projekte_id', $ACTIVE_ID)->get();
foreach ($res as $row) {
// See if cildreen exists
$res2 = ProjektObjekteImDetail::where('projekte_id', $ACTIVE_ID)->where('projekt_objekte_id', $row->id)->first();
if(!$res){
// If childree NOT exists delete parent
ProjektObjekte::where('id', $row->id)->delete();
}
}
Notification::make()
->title('Projekt reparieren')
->body('Die Reparatur des Projektes war erfolgreich.')
->icon('heroicon-o-exclamation-triangle')
->duration(10000)
->success()
->send();
// $res = ProjektInhaltsverzeichnis::where('projekte_id', $original_id)->get();
// foreach ($res as $row) {
// $check = ProjektInhaltsverzeichnis::where('projekte_id', $original_id)->where('top_nummer', $original->top_nummer)->first();
// if (! $check) {
// $new = $row->replicate();
// $new->projekte_id = $record->id;
// $new->save();
// }
// }
// $res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
// foreach ($res as $row) {
// $new = $row->replicate();
// $new->projekte_id = $record->id;
// $new->save();
// }
// $res = ProjektMerkmale::where('projekte_id', $record->id)->get();
// foreach ($res as $row) {
// $new = $row->replicate();
// $new->projekte_id = $record->id;
// $new->save();
// }
// $res = ProjektMethode::where('projekte_id', $record->id)->get();
// foreach ($res as $row) {
// $new = $row->replicate();
// $new->projekte_id = $record->id;
// $new->save();
// }
// $res = ProjektPlatzhalter::where('projekte_id', $record->id)->get();
// foreach ($res as $row) {
// $new = $row->replicate();
// $new->projekte_id = $record->id;
// $new->save();
// }
}
}
@@ -9,8 +9,8 @@ use App\Models\ProjektInhaltsverzeichnis;
use App\Models\ProjektMethode;
use App\Models\ProjektObjekte;
use App\Models\ProjektObjekteImDetail;
// use App\Models\ProjektPlatzhalter;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Auth;
class GutachtenValidation
{
@@ -24,7 +24,7 @@ class GutachtenValidation
/**
* Gutachter
*/
$res = Gutachter::where('konto_id', auth()->user()->konto_id)->where('id', $pro->gutachter_id)->first();
$res = Gutachter::where('konto_id', Auth::user()->konto_id)->where('id', $pro->gutachter_id)->first();
if (! $res->digitale_signatur_stempel) {
Notification::make()
->title('Gutacher')
@@ -155,7 +155,7 @@ class EditProjekte extends EditRecord
->color('success')
->label('Daten reparieren')
->modalIcon('phosphor-arrow-fat-line-right-fill')
->modalDescription( new HtmlString('<ol class="list-decimal"><li>Bei geklonten Projekten werden Änderungen vom originalen <u>Objekt</u> und <u>Objekt im Detail</u> übernommen.</li><li>Bei geklonten Projekten werden gelöschte <u>Objekt</u> und <u>Objekt im Detail</u> ergänzt.</li><li><u>Objekt im Detail</u> ohne Verbindung zum <u>Objekt</u> werden gelöscht.</li><li>Doppelte <u>Objekt</u> oder <u>Objekt im Detail</u> werden gelöscht.</li></ol>'))
->modalDescription( self::reparierenText())
// ->hidden(fn ($record): bool => ! $record->cloned_from_id)
->action(fn ($record) => Reparieren::run($record))
->icon('phosphor-arrow-fat-line-right-fill'),
@@ -173,4 +173,23 @@ class EditProjekte extends EditRecord
{
return 'Projekt Änderungen gespeichert';
}
protected function reparierenText(): ?HtmlString
{
$txt = '<div class="font-bold">Geklonte Projekte</div>';
$txt .= '<ol class="list-decimal">';
$txt .= '<li>Es werden Änderungen vom originalen <u>Objekt</u> und <u>Objekt im Detail</u> übernommen.</li>';
$txt .= '<li>Es werden gelöschte <u>Objekt</u> und <u>Objekt im Detail</u> ergänzt.</li>';
$txt .= '<li>Elemente ohne Verbindung zum Originale werden gelöscht.</li>';
$txt .= '</ol>';
$txt .= '<div class="font-bold">Alle Projekte</div>';
$txt .= '<ol class="list-decimal">';
$txt .= '<li><u>Objekt</u> ohne verbundene <u>Objekt im Detail</u> werden gelöscht.</li>';
$txt .= '<li><u>Objekt im Detail</u> ohne Verbindung zu einem <u>Objekt</u> werden gelöscht.</li>';
$txt .= '<li>Manuell hinzugefügte Elemente werden nicht gelöscht.</li>';
// $txt .= '<li>Doppelte <u>Objekt</u> oder <u>Objekt im Detail</u> werden gelöscht.</li>';
$txt .= '</ol>';
return new HtmlString($txt);
}
}
@@ -10,6 +10,7 @@ use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
@@ -37,6 +38,7 @@ class ProjektAllgemeinflaechensRelationManager extends RelationManager
{
return $schema
->components([
Hidden::make('added_manuel')->default(1),
TextInput::make('geschoss')
->required()
->maxLength(255),
@@ -14,6 +14,7 @@ use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Filament\Forms\Components\Select;
@@ -32,6 +33,7 @@ use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Auth;
use ToneGabes\BetterOptions\Forms\Components\RadioCards;
use ToneGabes\Filament\Icons\Enums\Phosphor;
@@ -53,6 +55,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
->components([
Tabs::make('Tabs')
->tabs([
Hidden::make('added_manuel')->default(1),
Tab::make('Überschrift')
->schema([
Checkbox::make('neue_seite')
@@ -157,7 +160,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
// $record = $mountedActions[0]->getRawData();
// $block = new KontoTextblock;
// $block->konto_id = auth()->user()->konto_id;
// $block->konto_id = Auth::user()->konto_id;
// $block->name = $data['name'];
// $block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
// $block->save();
@@ -171,7 +174,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
// Select::make('konto_textblock_id')
// ->hiddenLabel()
// ->searchable()
// ->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id'))
// ->options(KontoTextblock::where('konto_id', Auth::user()->konto_id)->pluck('name', 'id'))
// ->belowLabel([
// 'Bitte eine Vorlage auswählen',
// ]),
@@ -270,7 +273,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
$record = $mountedActions[0]->getRawData();
$block = new KontoTextblock;
$block->konto_id = auth()->user()->konto_id;
$block->konto_id = Auth::user()->konto_id;
$block->name = $data['name'];
$block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
$block->save();
@@ -284,7 +287,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
Select::make('konto_textblock_id')
->hiddenLabel()
->searchable()
->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id'))
->options(KontoTextblock::where('konto_id', Auth::user()->konto_id)->pluck('name', 'id'))
->belowLabel([
'Bitte eine Vorlage auswählen',
]),
@@ -12,6 +12,7 @@ use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
@@ -4,6 +4,7 @@ namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Actions\Create\CreatePlatzhalter;
use Filament\Actions\Action;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
@@ -27,6 +28,7 @@ class ProjektPlatzhalterRelationManager extends RelationManager
{
return $schema
->components([
Hidden::make('added_manuel')->default(1),
TextInput::make('platzhalter')
->required()
->maxLength(255),
@@ -29,12 +29,12 @@ class ProjektesTable
->columns([
TextColumn::make('id')->sortable(),
ToggleColumn::make('meine')
->state(fn ($record) => ProjektUser::where('user_id', auth()->user()->id)->where('projekte_id', $record->id)->count())
->state(fn ($record) => ProjektUser::where('user_id', Auth::user()->id)->where('projekte_id', $record->id)->count())
->beforeStateUpdated(function ($record, $state) {
if ($state) {
ProjektUser::create(['user_id' => auth()->user()->id, 'projekte_id' => $record->id]);
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $record->id]);
} else {
ProjektUser::where('user_id', auth()->user()->id)->where('projekte_id', $record->id)->delete();
ProjektUser::where('user_id', Auth::user()->id)->where('projekte_id', $record->id)->delete();
}
}),
TextColumn::make('interner_name')
@@ -71,7 +71,7 @@ class ProjektesTable
$data['meine'],
function (Builder $query, $meine) {
$query->whereHas('projekt_users', function ($query) {
$query->where('projekt_users.user_id', auth()->user()->id);
$query->where('projekt_users.user_id', Auth::user()->id);
});
}
);
+1 -1
View File
@@ -10,7 +10,7 @@ class ProjektObjekte extends Model
{
protected $fillable = [
'projekte_id',
'projekte_cloned_from_id',
'cloned_from_id',
'orientierung_id',
'nicht_in_orientierung',
'top_nummer',
+1 -1
View File
@@ -9,7 +9,7 @@ class ProjektObjekteImDetail extends Model
protected $fillable = [
'projekte_id',
'projekt_objekte_id',
'projekte_objekte_cloned_from_id',
'cloned_from_id',
'methode_id',
'top_nummer',
'geschoss',
@@ -13,10 +13,10 @@ return new class extends Migration
{
Schema::create('projektes', function (Blueprint $table) {
$table->id();
$table->integer('cloned_from_id')->default(0)->nullable();
$table->foreignId('konto_id')->constrained();
$table->foreignId('auftraggeber_id')->constrained();
$table->foreignId('gutachter_id')->constrained();
$table->integer('cloned_from_id')->default(0);
$table->string('interner_name');
$table->string('offizieller_name')->nullable();
$table->string('ort')->nullable();
@@ -14,6 +14,8 @@ return new class extends Migration
Schema::create('projekt_allgemeinflaechens', function (Blueprint $table) {
$table->id();
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
$table->integer('cloned_from_id')->default(0)->nullable();
$table->boolean('added_manuel')->default(0)->nullable();
$table->string('geschoss')->nullable();
$table->string('raumart')->nullable();
$table->decimal('flaeche', 7, 2)->default(0);
@@ -14,13 +14,13 @@ return new class extends Migration
Schema::create('projekt_objektes', function (Blueprint $table) {
$table->id();
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
$table->integer('projekte_cloned_from_id')->default(0);
$table->integer('cloned_from_id')->default(0)->nullable();
$table->boolean('added_manuel')->default(0)->nullable();
$table->integer('orientierung_id')->nullable()->default(0);
$table->boolean('nicht_in_orientierung')->default(0);
$table->string('top_nummer')->nullable();
$table->string('type')->nullable();
$table->decimal('nutzwert', 5, 2)->default(0)->nullable();
$table->boolean('added_manuel')->default(0)->nullable();
// 10 Zusatzfelder
$table->decimal('a', 5, 2)->default(0);
$table->decimal('b', 5, 2)->default(0);
@@ -14,14 +14,14 @@ return new class extends Migration
Schema::create('projekt_objekte_im_details', function (Blueprint $table) {
$table->id();
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
$table->integer('projekte_objekte_cloned_from_id')->default(0);
$table->integer('cloned_from_id')->default(0)->nullable();
$table->boolean('added_manuel')->default(0)->nullable();
$table->foreignId('projekt_objekte_id')->constrained()->cascadeOnDelete();
$table->foreignId('projekt_methode_id');
$table->string('geschoss')->nullable();
$table->string('raumart')->nullable();
$table->decimal('flaeche', 7, 2)->default(0);
$table->integer('nutzwert')->default(0)->nullable();
$table->boolean('added_manuel')->default(0)->nullable();
$table->timestamps();
});
}
@@ -14,6 +14,7 @@ return new class extends Migration
Schema::create('projekt_methodes', function (Blueprint $table) {
$table->id();
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
$table->integer('cloned_from_id')->default(0)->nullable();
$table->integer('methode_id')->nullable()->default(0);
$table->integer('aufstellung_id')->nullable()->default(0);
$table->string('raumart')->nullable();
@@ -14,6 +14,8 @@ return new class extends Migration
Schema::create('projekt_merkmales', function (Blueprint $table) {
$table->id();
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
$table->integer('cloned_from_id')->default(0)->nullable();
$table->boolean('added_manuel')->default(0)->nullable();
$table->string('code');
$table->string('name');
$table->timestamps();
@@ -14,6 +14,8 @@ return new class extends Migration
Schema::create('projekt_inhaltsverzeichnis', function (Blueprint $table) {
$table->id();
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
$table->integer('cloned_from_id')->default(0)->nullable();
$table->boolean('added_manuel')->default(0)->nullable();
$table->integer('inhaltselement_id')->default(0)->nullable();
$table->integer('inhaltsverzeichnis_id')->default(0)->nullable();
$table->integer('textblock_id')->default(0)->nullable();
@@ -14,6 +14,7 @@ return new class extends Migration
Schema::create('projekt_platzhalters', function (Blueprint $table) {
$table->id();
$table->foreignId('projekte_id')->constrained()->cascadeOnDelete();
$table->integer('cloned_from_id')->default(0)->nullable();
$table->text('platzhalter')->nullable();
$table->text('platzhaltertext')->nullable();
$table->boolean('controll')->default(0);