Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 591 | Revision 601 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 591 Revision 600
Zeile 2... Zeile 2...
2
 
2
 
Zeile 3... Zeile 3...
3
    namespace App\Console\Commands;
3
    namespace App\Console\Commands;
4
 
4
 
-
 
5
    use App\Models\Address;
5
    use App\Models\Address;
6
    use App\Models\Directory;
6
    use App\Models\Directory;
7
    use App\Models\DirectoryTemplate;
7
    use App\Models\Item;
8
    use App\Models\Item;
8
    use App\Models\Action;
9
    use App\Models\Action;
9
    use App\Models\Manufacturer;
10
    use App\Models\Manufacturer;
Zeile 21... Zeile 22...
21
    use App\Models\SalesPortalItem;
22
    use App\Models\SalesPortalItem;
22
    use App\Models\SalesPortalType;
23
    use App\Models\SalesPortalType;
23
    use App\Models\Shipping;
24
    use App\Models\Shipping;
24
    use App\Models\ShippingGroup;
25
    use App\Models\ShippingGroup;
25
    use App\Models\Shop;
26
    use App\Models\Shop;
-
 
27
    use App\Models\Template;
26
    use App\Models\User;
28
    use App\Models\User;
27
    use App\Models\OrderItem;
29
    use App\Models\OrderItem;
28
    use Illuminate\Console\Command;
30
    use Illuminate\Console\Command;
29
    use Illuminate\Support\Facades\DB;
31
    use Illuminate\Support\Facades\DB;
Zeile 70... Zeile 72...
70
                $this->migrateOrderAddresses();
72
                $this->migrateOrderAddresses();
71
                $this->migrateOrders();
73
                $this->migrateOrders();
72
                $this->migrateOrderItems();
74
                $this->migrateOrderItems();
73
                $this->migrateSalesPortalTypes();
75
                $this->migrateSalesPortalTypes();
74
            }
76
            }
-
 
77
            $this->migrateTemplates();
75
            $this->migrateSalesPortals();
78
            $this->migrateSalesPortals();
76
            $this->migrateSalesPortalItems();
79
            $this->migrateSalesPortalItems();
77
            $this->migrateMedia();
80
            $this->migrateMedia();
78
            $this->migrateActionMedia();
81
            $this->migrateActionMedia();
79
            $this->migrateDirMedia();
82
            $this->migrateDirMedia();
Zeile 1300... Zeile 1303...
1300
                ] );
1303
                ] );
1301
                $progressbar->advance();
1304
                $progressbar->advance();
1302
            }
1305
            }
1303
            $progressbar->finish();
1306
            $progressbar->finish();
1304
            $progressbar->clear();
1307
            $progressbar->clear();
-
 
1308
        }
-
 
1309
 
-
 
1310
        private function migrateTemplates()
-
 
1311
        {
-
 
1312
            $this->info( date( "d.m.Y H:i:s" ) . ": Migriere Templates" );
-
 
1313
            $start = 0;
-
 
1314
            $sql = "SELECT
-
 
1315
                    MAX(id) start
-
 
1316
                FROM
-
 
1317
                    templates
-
 
1318
            ";
-
 
1319
            $row = DB::connection( 'mysql' )->select( $sql );
-
 
1320
            if ( $row[0]->start )
-
 
1321
            {
-
 
1322
                $start = $row[0]->start;
-
 
1323
            }
-
 
1324
            $sql = "SELECT
-
 
1325
                    *
-
 
1326
                FROM
-
 
1327
                    templates
-
 
1328
                WHERE
-
 
1329
                    id>" . $start . "
-
 
1330
            ";
-
 
1331
            $templates = DB::connection( 'old' )->select( $sql );
-
 
1332
            $progressbar = $this->output->createProgressBar( count( $templates ) );
-
 
1333
            $progressbar->start();
-
 
1334
            foreach ( $templates as $template )
-
 
1335
            {
-
 
1336
                Template::factory()->create( [
-
 
1337
                    "id"             => $template->ID,
-
 
1338
                    "shop_id"        => $template->shops_ID,
-
 
1339
                    "name"           => $template->Name,
-
 
1340
                    "description"    => $template->Beschreibung,
-
 
1341
                    "template_key"   => $template->templateKey,
-
 
1342
                    "template_value" => $template->templateValue, ,
-
 
1343
                    "type"           => $template->Typ,
-
 
1344
                    "created_at"     => $template->erstellt_am,
-
 
1345
                    "updated_at"     => $template->letzte_Aenderung_am,
-
 
1346
                ] );
-
 
1347
                $progressbar->advance();
-
 
1348
            }
-
 
1349
            $progressbar->finish();
-
 
1350
            $progressbar->clear();
-
 
1351
            $start = 0;
-
 
1352
            $sql = "SELECT
-
 
1353
                    MAX(id) start
-
 
1354
                FROM
-
 
1355
                    directory_templates
-
 
1356
            ";
-
 
1357
            $row = DB::connection( 'mysql' )->select( $sql );
-
 
1358
            if ( $row[0]->start )
-
 
1359
            {
-
 
1360
                $start = $row[0]->start;
-
 
1361
            }
-
 
1362
            $sql = "SELECT
-
 
1363
                    *
-
 
1364
                FROM
-
 
1365
                    templates_to_artikel
-
 
1366
                WHERE
-
 
1367
                    id>" . $start . "
-
 
1368
            ";
-
 
1369
            $templates = DB::connection( 'old' )->select( $sql );
-
 
1370
            $progressbar = $this->output->createProgressBar( count( $templates ) );
-
 
1371
            $progressbar->start();
-
 
1372
            foreach ( $templates as $template )
-
 
1373
            {
-
 
1374
                DirectoryTemplate::factory()->create( [
-
 
1375
                    "id"           => $template->ID,
-
 
1376
                    "directory_id" => $template->directory_id,
-
 
1377
                    "template_id"  => $template->template_id,
-
 
1378
                ] );
-
 
1379
                $progressbar->advance();
-
 
1380
            }
-
 
1381
            $progressbar->finish();
-
 
1382
            $progressbar->clear();
Zeile 1305... Zeile 1383...
1305
 
1383
 
1306
        }
1384
        }