fix pdf methoth not showing, add in ObjekteImDetail projekt_methode_id for relation (kick out raumart for relation)
This commit is contained in:
1 parent
d95452bc9d
commit
fe826c3bab
8 files changed
+203
-37
No files matched your search
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Projekte;
|
||||
use App\Models\ProjektMethode;
|
||||
use App\Models\ProjektObjekteImDetail;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class FixMethodRelations extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* app:fix-method-relations
|
||||
*/
|
||||
protected $signature = 'app:fixdb1 {--d}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Fix relation in table "projekt_objekte_im_details" mit "projekt_methodes" id';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Notice::note('Start FixMethodRelations', 'b');
|
||||
|
||||
$projekte = Projekte::get();
|
||||
|
||||
foreach ($projekte as $projekt) {
|
||||
|
||||
$projektid = $projekt->id;
|
||||
|
||||
$methoden = ProjektMethode::where('projekte_id', $projektid)->pluck('id', 'raumart')->toArray();
|
||||
|
||||
$res = ProjektObjekteImDetail::where('projekte_id', $projektid)->get();
|
||||
|
||||
foreach ($res as $value) {
|
||||
|
||||
if (! $value->projekt_methode_id) {
|
||||
|
||||
if (isset($methoden[$value->raumart])) {
|
||||
$projekt_methode_id = $methoden[$value->raumart];
|
||||
|
||||
ProjektObjekteImDetail::where('id', $value->id)->update(['projekt_methode_id' => $projekt_methode_id]);
|
||||
} else {
|
||||
Notice::note('Error: Methode für Raumart '.$value->raumart.' in Projekt'.$projekt->interner_name.' Id '.$projekt->id.' Methode missing', 'r');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
class Notice
|
||||
{
|
||||
// note
|
||||
|
||||
public static function db($message, $exit = false)
|
||||
{
|
||||
echo "\e[0;35m";
|
||||
echo PHP_EOL.'-----------------------------------------------------------'.PHP_EOL;
|
||||
if (is_array($message)) {
|
||||
print_r($message);
|
||||
} else {
|
||||
echo $message.PHP_EOL;
|
||||
}
|
||||
echo '-----------------------------------------------------------'.PHP_EOL;
|
||||
echo "\e[0;39m";
|
||||
if ($exit) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
public static function note($message, $color = '', $exit = false)
|
||||
{
|
||||
switch ($color) {
|
||||
case 'g':
|
||||
// green
|
||||
echo "\e[0;32m";
|
||||
break;
|
||||
case 'gb':
|
||||
case 'bg':
|
||||
// bold green
|
||||
echo "\e[1;32m";
|
||||
break;
|
||||
case 'r':
|
||||
// red
|
||||
echo "\e[0;31m";
|
||||
break;
|
||||
case 'br':
|
||||
case 'rb':
|
||||
// bold red
|
||||
echo "\e[1;31m";
|
||||
break;
|
||||
case 'b':
|
||||
// blue
|
||||
echo "\e[0;34m";
|
||||
break;
|
||||
case 'bb':
|
||||
// bold blue
|
||||
echo "\e[1;34m";
|
||||
break;
|
||||
case 'y':
|
||||
// yellow
|
||||
echo "\e[0;33m";
|
||||
break;
|
||||
case 'p':
|
||||
// purple
|
||||
echo "\e[0;35m";
|
||||
break;
|
||||
case 'c':
|
||||
// cyan
|
||||
echo "\e[0;36m";
|
||||
break;
|
||||
case 'bi':
|
||||
// blue intence
|
||||
echo "\e[38;5;33m\n";
|
||||
break;
|
||||
default:
|
||||
echo "\e[0;39m";
|
||||
break;
|
||||
}
|
||||
|
||||
echo PHP_EOL.'-----------------------------------------------------------'.PHP_EOL;
|
||||
if (is_array($message)) {
|
||||
print_r($message);
|
||||
} else {
|
||||
echo $message.PHP_EOL;
|
||||
}
|
||||
echo '-----------------------------------------------------------'.PHP_EOL;
|
||||
echo "\e[0;39m";
|
||||
if ($exit) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
public static function html($message, $color = '', $exit = false)
|
||||
{
|
||||
switch ($color) {
|
||||
case 'g':
|
||||
echo '<div style="margin:10px; padding:3px; color:green; width=20rem; text-align:center; border:solid 1px green; background-color:lightgreen;">';
|
||||
break;
|
||||
case 'r':
|
||||
echo '<div style="margin:10px; padding:3px; color:red; width=20rem; text-align:center; border:solid 1px red; background-color:#fdd;">';
|
||||
break;
|
||||
case 'b':
|
||||
echo '<div style="margin:10px; padding:3px; color:blue; width=20rem; text-align:center; border:solid 1px blue; background-color:lightblue;">';
|
||||
break;
|
||||
default:
|
||||
echo '<div style="margin:10px; padding:3px; color:black; width=20rem; text-align:center; border:solid 1px black; background-color:#eee;">';
|
||||
break;
|
||||
}
|
||||
if (is_array($message)) {
|
||||
print_r($message);
|
||||
} else {
|
||||
echo $message;
|
||||
}
|
||||
echo '</div>';
|
||||
if ($exit) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user