This commit is contained in:
salam committed 2026-07-05 18:14:23 +02:00
1 parent 16c0aa24fe
commit 4a509c6a16
16 files changed
+168 -82

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ class CloneProjekt
$news_project->cloned_from_id = $record->id;
$news_project->save();
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $news_project->id]);
ProjektUser::create(['user_id' => Auth::user()->id, 'projekte_id' => $news_project->id, 'evaluation_gutachten' => 0]);
$res = ProjektObjekte::where('projekte_id', $record->id)->get();
foreach ($res as $row) {
@@ -11,9 +11,9 @@ use App\Models\ProjektObjekte;
use App\Models\ProjektObjekteImDetail;
use App\Models\ProjektPlatzhalter;
class CloneValidation
class Reparieren
{
public static function validate(Projekte $record)
public static function run(Projekte $record)
{
/**
* projektes
@@ -29,29 +29,33 @@ class CloneValidation
$ORIGINAL = $record->cloned_from_id;
$GEKLONT = $record->id;
// $originals = ProjektObjekte::where('projekte_id', $ORIGINAL)->get();
// foreach ($originals as $original) {
// $check = ProjektObjekte::where('projekte_id', $GEKLONT)->where('top_nummer', $original->top_nummer)->first();
// if (! $check) {
// /**
// * Im original dazugekommen
// */
// $new = $original->replicate();
// $new->projekte_id = $GEKLONT;
// $new->save();
if($ORIGINAL){
// überprüfe geklontes Projekt!
$originals = ProjektObjekte::where('projekte_id', $ORIGINAL)->get();
foreach ($originals as $original) {
$check = ProjektObjekte::where('projekte_id', $GEKLONT)->where('top_nummer', $original->top_nummer)->get();
dd($check);
if (! $check) {
/**
* Im original dazugekommen
*/
$new = $original->replicate();
$new->projekte_id = $GEKLONT;
$new->save();
// $res2 = ProjektObjekteImDetail::where('projekte_id', $ORIGINAL)->where('projekt_objekte_id', $original->id)->get();
// foreach ($res2 as $row2) {
// $check = ProjektObjekteImDetail::where('projekte_id', $GEKLONT)->where('raumart', $row2->raumart)->first();
// if (! $check) {
// $new2 = $row2->replicate();
// $new2->projekte_id = $GEKLONT;
// $new2->projekt_objekte_id = $new->id;
// $new2->save();
// }
// }
// }
// }
$res2 = ProjektObjekteImDetail::where('projekte_id', $ORIGINAL)->where('projekt_objekte_id', $original->id)->get();
foreach ($res2 as $row2) {
$check = ProjektObjekteImDetail::where('projekte_id', $GEKLONT)->where('raumart', $row2->raumart)->first();
if (! $check) {
$new2 = $row2->replicate();
$new2->projekte_id = $GEKLONT;
$new2->projekt_objekte_id = $new->id;
$new2->save();
}
}
}
}
}
// $res = ProjektAllgemeinflaechen::where('projekte_id', $original_id)->get();
// foreach ($res as $row) {