Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1632 | Revision 1634 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
151 lars 1
<?php
2
 
1623 lars 3
    namespace App\Console\Commands;
151 lars 4
 
1623 lars 5
    use Illuminate\Console\Command;
6
    use App\Models\PriceAgency;
151 lars 7
 
1623 lars 8
    class dump extends Command
9
    {
10
        /**
11
         * The name and signature of the console command.
12
         *
13
         * @var string
14
         */
15
        protected $signature = 'command:dump';
151 lars 16
 
1623 lars 17
        /**
18
         * The console command description.
19
         *
20
         * @var string
21
         */
22
        protected $description = 'Erstellt CSV-Dateien für Preisagenturen';
151 lars 23
 
1623 lars 24
        /**
25
         * Execute the console command.
26
         *
27
         * @return int
28
         */
29
        public function handle(): int
30
        {
1633 lars 31
            $agencies = PriceAgency::where( 'shop_id', $GLOBALS["INI"]["shops_ID"] )->where( "status", "1" )->get();
1623 lars 32
            foreach ( $agencies as $agency )
33
            {
34
                $this->info( $agency["name"] );
1631 lars 35
                if ( !$agency["config"] )
36
                {
37
                    $this->warn( "Agentur nicht komplett konfiguriert!" );
1632 lars 38
                    continue;
1631 lars 39
                }
1630 lars 40
                $configFile = storage_path( "config/" ) . $agency["config"];
41
                if ( file_exists( $configFile ) )
42
                {
43
                    require $configFile;
44
                }
45
                else
46
                {
47
                    $this->error( "Konfigdatei " . $configFile . " existiert nicht!" );
48
                }
1623 lars 49
            }
1627 lars 50
            return count( $agencies );
1623 lars 51
        }
151 lars 52
    }